Ubuntu – How to prevent other users from accessing the home directory

permissions

I am trying to restrict access to my home directory so as to prevent another user from accessing it, even another that user also has sudo permissions.

I've tried the following commands to achieve this

sudo chmod 0750 /home/user    
sudo chmod 0755 /home/user

but if other user have sudo permissions they can change the permissions easily using

sudo chmod 0755 /home/user

Is there another way around this?

Best Answer

You can't do that. If you give sudo permission for user, he can execute any command or access any files on that system. If you don't trust your user, give him restrictive sudo access to execute only a few commands by editing /etc/sudoers file. Create a new group admins

Add lines to /etc/sudoers

%admins ALL =  <Full path to command 1>, <Full path to command 2>
Related Question