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 was wondering if there is a way to restrict access in ssh. More specifically I was wondering if I can prevent a user from going anywhere outside their home directory and "roaming" around where they shouldn't.
I tested this as a test user and I couldn't execute or view anything but I could change directories and list them wherever I pleased as long as it wasn't root access specific.
I don't want them changing directory out of their home directory at all...
to restrict access, just use the /etc/hosts.allow and /etc/hosts.deny files.
simply place this in your hosts.deny file:
ALL:ALL
to keep out everyone.
then to allow only certain IP addresses to have access to a connection on your box, use the hosts.allow and add in entries like this:
ALL:127.0.0.1
ALL:192.168.0.
ALL:172.135.
ALL:65.
You should most likely have the 127.0.0.1 entry in there always. Just add in the IP addresses you trust. you can use the class A,B,C in the different examples like i did.
Now your box will check the hosts.allow for a matching rule first, then pass it to hosts.deny if there is nothing matching in the allow section. That means that the ALL:ALL entry will be checked AFTER your allowed IP addresses are checked.
I hope that will at least help you with the unwanted connections. As for the roaming around, i think capt caveman's ideas are good ideas.
Originally posted by VioLaToR to restrict access, just use the /etc/hosts.allow and /etc/hosts.deny files.
simply place this in your hosts.deny file:
ALL:ALL
to keep out everyone.
then to allow only certain IP addresses to have access to a connection on your box, use the hosts.allow and add in entries like this:
ALL:127.0.0.1
ALL:192.168.0.
ALL:172.135.
ALL:65.
You should most likely have the 127.0.0.1 entry in there always. Just add in the IP addresses you trust. you can use the class A,B,C in the different examples like i did.
Now your box will check the hosts.allow for a matching rule first, then pass it to hosts.deny if there is nothing matching in the allow section. That means that the ALL:ALL entry will be checked AFTER your allowed IP addresses are checked.
I hope that will at least help you with the unwanted connections. As for the roaming around, i think capt caveman's ideas are good ideas.
You're trying to restrict login access to the machine. The OP is trying to restrict access to a user's home directory after they log in.
Originally posted by comp12345 You're trying to restrict login access to the machine. The OP is trying to restrict access to a user's home directory after they log in.
that was why i said:
Quote:
As for the roaming around, i think capt caveman's ideas are good ideas.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.