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

Plans for Ubuntu 7.10 (Gutsy Gibbon) revealed

Another Ubuntu Release in the works!
To give you the rundown on the notable changes. The desktop version will be shipping with a new default windows manager that looks kinda like Mac OSX:


We are aiming for Ubuntu to be one of the first distributions to ship
the newly merged Compiz and Beryl projects (compcomm/OpenCompositing);
and enable it as the default window manager on systems with a supported
combination of hardware and drivers.



http://compiz.org


cube effect peel effect cube effect cube effect


And the addition of AppArmour to the Server version of Ubuntu:




For increased security, the AppArmor security framework will be
available as an option for those that want it.

The following is the original statement by the Ubuntu Development Manager.


Now that the set of feature goals planned for Ubuntu 7.10 ("Gutsy
Gibbon") has been largely finalised, it seems like an appropriate point
to announce the plan to the world.
While this is based on the approved blueprints for gutsy[0], which are
expected to be implemented in time, we do release according to a
time-based schedule[1] rather than a feature-based one. It is not
unusual for some planned features to be delayed to later releases;
happily it is also not unusual for our developers to introduce neat
features we weren't expecting either.
[0] https://blueprints.launchpad.net/ubuntu/gutsy/
[1] https://wiki.ubuntu.com/GutsyReleaseSchedule
Desktop
-------
Ubuntu 7.10 will ship with the latest edition of the GNOME desktop,
2.20, released a few weeks before our own release. Kubuntu 7.10 will
ship with KDE 3.5.7, and should also include packages of KDE 4.0 rc 2
available for optional side-by-side installation.
We are aiming for Ubuntu to be one of the first distributions to ship
the newly merged Compiz and Beryl projects (compcomm/OpenCompositing);
and enable it as the default window manager on systems with a supported
combination of hardware and drivers.
Systems which do not support compositing, or those with it disabled by
user option, will use the existing metacity window manager.
Hardware Support
----------------
Ubuntu 7.10 will use the 2.6.22 Linux kernel, along with our usual
selection of updated and additional drivers.
We will also use Xorg 7.3, giving better graphics hardware support and
the option of hotplugging monitors (RandR 1.2) and input devices
(xserver 1.4).
As well as the easier configuration for hotplugging-supported drivers
("no xorg.conf"), we also aim to have better configuration for other
drivers and fallback settings for when there is a problem.
Some "winmodem" chips will be supported out of the box, where drivers
are available; though this may rely on the use of restricted drivers.
Improvements to the Restricted Driver Manager are expected, allowing
drivers to be disabled by default and proposed by the manager. As
previously announced, an edition of Ubuntu without restricted enabled by
default is in the works.
Mobile
------
As announced, Ubuntu 7.10 will be first release to include a new Mobile
and Embedded edition targeted at hand-held devices and other
mobile/embedded form factors.
This integrates the Hildon UI components developed by Nokia into Ubuntu,
on top of the existing Ubuntu platform.
Server
------
Development of the Ubuntu 7.10 Server Edition has received a new boost
with a dedicated development team at Canonical working on it. Features
aiming to improve the experience for new and hobbyist administrators are
expected, as well as features desirable for small businesses and
organisations.
For increased security, the AppArmor security framework will be
available as an option for those that want it.
Stability and Performance
-------------------------
Ubuntu 7.10 should function significantly better when the filesystem is
full or otherwise not writable, allowing the user to make room and then
continue working without undue interruption.
Improvements to our "apport" bug and crash reporting infrastructure are
planned, in particular integration with our software installation and
upgrade tools so that problems installing or upgrading packages can be
easily reported with relevant information attached. Kernel crashes will
also be intercepted on reboot, and may be reported using the tool.
Our efforts to improve boot reliability and performance continue;
unlimited and reliable stackability of software raid (MD) devices, LVM
volumes and software-managed (devmapper) devices will be supported with
no runtime ordering issues.
Ubuntu 7.10 will ship with Upstart 0.5, which will provide flexible and
reliable service supervision. We expect to harness this for suitable
core services, and some boot process tasks, as appropriate.
Scott
--
Scott James Remnant
Ubuntu Development Manager
scott at ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/ubuntu-devel-announce/attachments/20070619/d46e34e1/attachment.pgp


Read More

Comcast fires employees for talking about P2P filtering

It looks as though Comcast has fired a few employees for talking out of script.
In the wake of the discovery that Comcast is blocking some peer-to-peer traffic (and even blocking some Lotus Notes e-mails), the company is attempting to keep the PR machine well-oiled by giving customer tech support reps some talking points. And if they deviate from the script and admit that Comcast has been using Sandvine to send forged TCP reset packets, they're likely to lose their jobs.
Read More

Seagate unveils turmoil-proof EE25.2 hard drive

Seagate unveils turmoil-proof EE25.2 hard drive - As if stuffing a quarter terabyte onto a single Barracuda platter and finally matching Hitachi in the 1TB realm weren't enough to gloat about, Seagate is now unveiling a hard drive aimed squarely at those reading this from the Amazon Rainforest (or a vanilla construction area, but you understand). The second-generation SATA EE25 drive -- easily dubbed the EE25.2 -- is available in sizes up to 80GB and can handle extreme temperatures, sensational heights, 'round the clock operation, 90-percent humidity, and drops / shocks that would likely put you out of commission before your data. No word yet on pricing nor availability, but don't expect 80 gigabytes of nearly indestructible storage to come without a premium.

 

Read | Permalink | Email this | Comments


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

[EnGadget]
Read More

What happened to Apple Customer Service?

A nice little article about how Apples growth is affecting its customers, is Apple short changing all of its loyal customers, fans and newly won over customers by looking more for profit rather than customer satisfaction?
Read More