If you and others share Ubuntu machine, then you may want to set up multiple users, want other users to log on to their account and can only access their own home directory. However, by default, any user can access any one of the home directory.
When you add a new user in Ubuntu, adduser tools for the new account added to a new home directory. By default, the root directory is located below / home / directory, and the name of the account user name. For example, / home / lori. The user's home directory created Ubuntu have other people read / execute permissions, which gives the system all other users can read a number of additional rights outside the user's home directory content. For details, please read our article file permissions in Linux is how it works.
NOTE: When we enter what is mentioned in the text, enter the text in quotation marks, do not enter the quotes, unless we specify otherwise.
You can easily modify your home directory permissions to protect your private files. To check the permissions of your home directory, enter Ctrl + Alt + T to open a terminal window and enter the following command at the prompt, then press Enter. Use your own user name to replace the following "user name."
ls -ld / home / lori
Note: This command contains only lowercase L, not the number 1. (LCTT Annotation: This is totally white to suggest that the vast majority of people can ignore the remarks)
In the beginning of the line that lists the permissions on the file. As we in the article about the Linux permission to speak as part of.
r indicates "read", w stands for "write" and x means "execute." Directory permissions to "d" at the beginning, instead of "-." You will also notice the permissions value accounted for 10 positions. You can ignore the first, followed by a group of three, divided into three groups. The first group is the owner (owner) permission, the second group is a group (group) permissions, and the last group of other people (other or the world) permission.
Thus, the owner of the home directory listed below has read, write, and execute permissions, and belongs to the group and others have read and execute permissions.
To modify these permissions, enter the following line at the prompt and press Enter
sudo chmod 0750 / home / lori
When you are prompted for a password, enter and press Enter.
Note: chmod command uses octal numbers as a way to assign permissions. We are talking about Linux use rights article a different method, which takes a few steps, but may be easier to understand. Octal numbers to specify the permissions, is a faster way. Regardless of the method, as long as you like with a comfortable.
Press the up arrow twice, called again "ls -ld / home / username" command to check the permissions. Note that other people permission are now dash (-), which means that other people can not read, write or execute your home directory anything.
However, with your user and group can read and execute your home directory files and folders. If you do not want anyone except you access your home directory, you can enter "0700" in the chmod command.
NOTE: For more information about the Linux user and group management, please see our article
To close the terminal window, at the prompt enter "exit" and press Enter.
Now, when their systems of other users trying to access your home directory, the following dialog box will pop up.
You may even make Ubuntu use permissions specified when creating a new user. To accomplish this task, you need to edit the configuration file adduser. To edit the file, enter the following command at the prompt and press Enter.
gksudo gedit /etc/adduser.conf
We use gedit to edit the file, you can also use other text editor you want.
NOTE: gksudo command sudo command and seemingly the same, but it is used as root to run graphical applications, and sudo command to run as root command-line program.
In the pop-up dialog box, enter the password to edit your password and press Enter or click OK (OK).
Scroll down to the file in adduser.conf DIR_MODE command prompt, where the default value is "0755." Modify the value to reflect you want to empower the various types of users (owner, is a group, others) of different permissions (r, w, x), as we discussed earlier, "0750" or "0700." Click Save (Save).
(File) menu, choose Exit (Quit) to close gedit from gedit file, you can also click on the top left corner of the X button to close it.
Click on the top left corner of the X to close the terminal window.
Now, your home directory files will remain private. Remember, if you and another user in the same group, you might want for your home directory permissions and the general public excluding group privileges.