How to restrict users in linux to their home directory

So lets say you have a server with a bunch of users and they all have sites and data and you don’t want them to be able to see each others data. A lot of distributions aren’t setup to stop users from wandering and reading files within other users directories.

So lets say you have a server with a bunch of users and they all have sites and data and you don’t want them to be able to see each others data. A lot of distributions aren’t setup to stop users from wandering and reading files within other users directories.

What you will need to do is change the permissions on the /home and each users directory using chmod. So first we need to change the permission on “/home”


[root@taco:/]# chmod 0751 /home
[root@taco:/]# stat home
File: `home'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 900h/2304d Inode: 2 Links: 32
Access: (0751/drwxr-x--x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2007-12-03 13:58:07.000000000 -0800
Modify: 2007-11-21 12:10:17.000000000 -0800
Change: 2007-12-03 13:57:28.000000000 -0800

As you can see the folder is now set to 0751, depending you may want to change this but by default this should be fine.

Now you need to change the permission on each users directory using chmod yet again


[root@taco:/]# chmod 0751 jordan
[root@taco:/home]# stat jordan
File: `jordan'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 900h/2304d Inode: 19709953 Links: 15
Access: (0751/drwxr-x--x) Uid: ( 1000/ jordan) Gid: ( 1000/ jordan)
Access: 2007-12-03 12:14:23.000000000 -0800
Modify: 2007-11-14 11:06:38.000000000 -0800
Change: 2007-12-03 13:57:42.000000000 -0800

Now your users shouldn’t be able to see other users on your system!


Did you like this article?


0 Shares:
You May Also Like

Novell and RedHat Linux vs IP Innovation LLC: Was Ballmer right?

A good read from Groklaw, it goes on about the the current filed Patent Infringement Claim put forth by IP Innovation LLC.
Patent Infringement Lawsuit Filed Against Red Hat & Novell - Just Like Ballmer Predicted IP Innovation LLC has just filed a patent infringement claim against Red Hat and Novell. It was filed October 9, case no. 2:2007cv00447, IP Innovation, LLC et al v. Red Hat Inc. et al, in Texas. Where else? The patent troll magnet state. The first ever patent infringement litigation involving Linux. Here's the patent, for those who can look at it without risk. If in doubt, don't. Here's the complaint [PDF].
Read More

NASA funded robots to search for life under Arctic ice

NASA funded robots to search for life under Arctic ice -

Filed under:

In a mission that is apparently similar to searching for life under the ice of Jupiter's moon Europa (sans the space travel part), three robots are set to start a mission to explore the underwater hot springs under the ice of the Arctic: because someone else did the Antarctic last year. On a 40 day expedition in July, researchers from Cape Cod hope to use three new robotic vehicles -- two that can operate without cables under ice -- to find life that resides in the hot streams along the techtonic boundary between Eurasia and North America. Although the robots can descend over 3 miles under the water working just meters from the bottom to photograph objects and collect samples, the task of the NASA-funded $450,000 Puma and Jaguar robots will be hindered by the rough terrain and their inability to surface through the ice. Sounds like NASA's got quite a while to go until it can submarine around Europa -- they probably won't be able to surface there at all.
[EnGadget]
Read More

Good Ways To Join an Open Source Project?

Good Ways To Join an Open Source Project? - Tathagata asks: "I'm a student, on my final year in a college in India, and I have been using GNU/Linux for quite sometime now. Though I'm from a Computer Science background, getting into a project that involves serious programming was not possible, as people (read teachers) run away if you utter the word 'Linux'. They are generally not bothered about mentoring someone on an exciting project, and they would suggest you to get settled with Visual Basic, .NET, — and would prefer a 24 hour solution when it comes to programming. So, my programming endeavors have remained limited to writing few lines of C/C++, or Java. For last few days, I've been googling, and trying to read how to join an existing Open Source project." What suggestions would you pass along to someone who is willing to join his first Open Source effort?

Read more of this story at Slashdot.

[Slasdot]
Read More