[SOLVED] custom login script for *shared account* (using SSH)
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
custom login script for *shared account* (using SSH)
There is a shared account (not by choice, and not my choice). I ssh into it, along with many other users. Some users share the password, others use the public key method (each user has their own pair of keys).
I have a number of shell preferences that I would not want to affect other users. So changing .bashrc, .profile, .kshrc, etc types of scripts in the shared account is not practical, because changing them would affect everyone. What would be a practical way to have a script execute automatically, only when logging in by way of my private (id_rsa) key? Could I perhaps change the .profile in a way that it runs some commands only if my public key was used to authenticate the login?
but it simply terminates when done. I want it to hand the shell over to me.
Also, when many users are logged in, the "w" command shows several users with the same shared username. Is there anything I can do to make my own session distinct? E.g. instead of showing username "sharedUser", I want it to show "gnuweenie via sharedUser", or something.
Last edited by gnuweenie; 03-03-2011 at 02:15 PM.
Reason: solved
You could also setup a generic ~/.profile or alike and inside you have cases depending on $SSH_CLIENT (the address of origin), or a custom set variable which you export to the SSH login by -oSendEnv=foobar or alike (when it's configured in the server).
Last edited by Reuti; 03-03-2011 at 05:04 AM.
Reason: Formatting
Just make 'bash' the last command you execute. For example:
Code:
ssh remotesystem 'ls;bash'
That doesn't work for me. I tried it in a few cases, and the session simply runs all the commands before the bash and terminates.
Quote:
Originally Posted by Reuti
You could also setup a generic ~/.profile or alike and inside you have cases depending on $SSH_CLIENT (the address of origin), or a custom set variable which you export to the SSH login by -oSendEnv=foobar or alike (when it's configured in the server).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.