4
1
I want nobody to access my private folder, I'd like to set a password for it or just make it only accessible by root
user.
How can I get it? I'm using Ubuntu.
4
1
I want nobody to access my private folder, I'd like to set a password for it or just make it only accessible by root
user.
How can I get it? I'm using Ubuntu.
6
As the owner or root, execute the command
# chmod -R 700 /path/to/folder
The chmod
command changes the permissions of the file/folder. The 700
means that the owner has full access, and no one else. The -R
means to apply the rules recursively (through subfolders). You will also want to run a chown
# chown user:user -R /path/to/folder
The chown
command changes the owner of the file/folder. The user:
part is the username to apply the owner as; the :user
part is for the group. Every user typically has it's own group as well. Again, the -R
is to recurse through to subfolders.
Not a problem! Don't be afraid of upvoting as well once you get the reputation – Canadian Luke – 2013-09-02T23:29:42.760
2
To add to Canadian Luke's answer:
It is actually not required to set the entire contents (recursively) of a folder to chmod -R 700
.
In order to access a directory or any child content, you need +x
permissions for your user. If you remove that the user can not access any of the child contents of this folder, no matter what the permission of the contents are.
In the above case, the command below would be enough:
# chown user:group /path/to/folder
# chmod go-x /path/to/folder
That way you can restrict access without changing the permissions or ownership inside your folder.
1
I'd suggest taking a look at encfs. It's easy to set up and use, and will encrypt a directory using the password of your choice. On ubuntu, it's available via apt as the encfs
package. Setting up a new encfs volume is as easy as
$ encfs ~/.priv ~/priv
where ~/.priv
will be the encrypred version. See the link in this post for a more detailed intro to the tool.
I've summed up some essentials about users and privileges in this answer here: http://unix.stackexchange.com/questions/102911/how-to-set-root-permission-for-all-users/102917#102917 - this might give you some more grip on this topic named "MODES" -> "https://en.wikipedia.org/wiki/Modes_(Unix)
– erch – 2013-12-07T13:55:20.197