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.
I want to configure that this user only has one ssh connection, example:
Temp1 is already connected and if someone tries to connect again with Temp1 it will be rejected.
Also I need to know how I can limit users Temp so they can just execute only a few commands.
Well, that's not necessarily a good thing to do. If sshdthinks that you still have a session going, but you don't, then this can lock you out of a remote machine. Very messy.
As you've probably seen, to limit SSH login to specific users, put them in a group and then set AllowGroups in sshd_config accordingly.
If you want to limit which programs an account can use while logged, that is much harder and you must turn to rbash or rksh. That's just the first step.
The second step is to make a read-only directory, say /usr/local/rbin, and populate it with links (symbolic or hardlinks) to only the programs that the restricted account would be allowed to, and needs to, run.
The next step is to set $PATH for the restricted user and remove the ability to write to the home directory and .basrc and .profile especially. The other files and directories can be writeable but it is essential that the restricted account be unable to modify $PATH. If it is too undesirable to limit the home directory permissions, then you'll have to modify /etc/profile, /etc/profile.d/*, and /etc/bash.bashrc instead. That might be trickier unless you are familiar with shell scripting.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.