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

JkDefrag 3.16

JkDefrag 3.16 - Free (released under the GNU General Public License) disk defragment and optimize utility for Windows 2000/2003/XP/Vista/X64. Completely automatic and very easy to use, fast, low overhead, with two optimization strategies, and can handle floppies and USB disks/sticks. Included are a Windows version, a commandline version (for scheduling by the task scheduler or for use from administrator scripts), a screensaver version, a DLL library (for use from programming languages), and versions for Windows X64. JkDefrag is based on the standard defragmentation API by Microsoft, a system library that is included in Windows 2000, 2003, XP, and Vista. All defragmenters are based on this API, including commercial defragmenters. JkDefrag is therefore very solid and there is no risk of losing data. You can stop the program at any time, it will finish the current file in the background. If your disks use NTFS then you're even safe when the computer crashes in the middle of defragging. Nevertheless, it's still a good idea to backup before defragmenting, just like with other defragmenters, because the heavy use of the harddisk may trigger a hardware fault.

Changes in this version:

- Changed the message in the docs about the screensaver under Vista, it works if User Account Control is turned off.
- Bugfix in "-a 3" (fast optimize). It would not use Perfect Fit for gaps that were larger than all the data already processed.

Read full story...

[NeoWin-Software]
Read More

How to setup the perfect desktop in Ubuntu Gutsy Gibbon

The following article from howtoforge.com shows how to setup the perfect Linux Desktop using Ubuntu Gutsy Gibbon. If you've always wanted to use Ubuntu as your desktop OS, then give this article a read and follow along using a Virtual Machine or VMWare Player.
Read More

OiNK.cd Servers Raided, Admin Arrested

The Administrator of the most popular private Torrent Trackers OiNk.cd was arrested. The 24-year-old man from Middlesbrough was arrested. The British and Dutch Police stated that they confiscated the OiNk.cd servers in Amsterdam last week, however reports of the site still being active and fully functional 24 hours ago.
Read More

Report: Vista more secure than OS X and Linux

Report: Vista more secure than OS X and Linux -

Filed under: , ,


Attention Linux, Vista, and Apple fan boys: put on your gloves... it's time to rumble! A 6-month vulnerability report issued by Jeff "Security Guy" Jones has caught the eye of Redmond and the ire of places beyond. The report which bases its security assessment upon vulnerabilities found (not actually exploited) claims that Vista is "more secure than OS X and Linux." In fact, the much maligned XP even crushes the competition using their calculations. Of course, it's worth noting that Jeff is a member of Microsoft's Security business unit which will probably sway your opinion as to the integrity of the data. Still, as incomplete as the assessment may be, it certainly appears to be a good showing for Vista considering the vast community of hackers attempting to thwart its security. Of course you know what Billy G's probably saying right about now? Dy-no-mite JJ!

[Via vnunet]

Read -- 6 Month Vulnerability Report [warning: PDF]
Read -- JJ's blog entry

 

Permalink | Email this | Comments


Office Depot Featured Gadget: Xbox 360 Platinum System Packs the power to bring games to life!

[EnGadget]
Read More