I have some downloads in my root user /root/Downloads folder. How can I access them from another
It would be possible to access the root's files/directories by simply changing the permissions.
However I don't recommend to do so because this would be a big security hole. However on personal computer, it won't be such a big issue.
Still, if you want to achieve this, you would need to add the following permissions flags to the
x - this means that you can open/access the directory (
cd to dir) but you can't read it's contents
r - this will allow you to read the directory contents
chmod o+x,o+r /root
Note: You need to be root (
su root) when running this command.
The directories inside
/root should already have read/execute permissions for other users so you shouldn't encounter further issues.
By non-root-user you mean user that is not in
sudoers file or just other user that can execute command as root with
In a former occasion - there is no way you can access root's home folder.
In the later, you can
sudo su and you're effectively a root user now (if sudo doesn't restrict user's priveleges in any way explicitly).
Assign the files to a group to which the non-root user belongs to.
In most modern Linux systems, each user have their own group corresponding to their username.
You can change the group ownership of a file or directory with the
chgrp group_name pathname
However, note that the non-root user also needs directory access for all parent directories, including
/root itself, to access files under
/root/Downloads, which is usually not allowed. Without read priviledges for the parent directories, there's still restrictions on listing the contents of the directory contents for directories under
/root. In your particular case you would need to give
x permissions for
/root/Downloads to regular users:
$ chmod o+x /root /root/Downloads $ chgrp user /root/Downloads/file-non-root-user-needs-to-access
I strongly suggest you want to move them somewhere outside the directory
/root. This will help avoid breaking the conventions on security, as others have warned about.
Moving files can be much faster than copying them. Provided they stay on the same filesystem, all that needs to be written is new file metadata (example: selinux).
E.g. you can create
/shared-readonly/ and move files there with
mv. You don't need to change access modes at all :). This specific setup (or using
/home/shared-readonly) is very nice and simple. I've used it several times myself. (Directories which can be written by multiple users are inherently a bit more complex; sadly they're not as robust on Linux as they could be).
You could additionally limit this sharing to
not-root-user, e.g. to avoid exposing personal data to arbitrary non-root daemons. Create a group as follows, e.g. here I name it
groupadd conspiracy usermod -a -G conspiracy not-root-user chgrp conspiracy /shared-readonly chmod o-rx /shared-readonly
not-root-user will need to log out and back in, before they are recognized as a member of
id -a to check their membership.
If you like to have convenient, visible access to the files as the root user, you can also create a symbolic link to them. E.g.
ln -s /shared-readonly .
This answer is for Kali Linux (Linux basically) and may not work for Ubuntu.
I have a better answer to solve the issue as I've just solved mine.
The most voted answer here doesn't work for Kali Linux (don't know about Ubuntu). The error is
chmod: invalid mode: ‘o+x,’
Try 'chmod --help' for more information.
Now the solution without any code:
- Go to the root account and right click the folder you want to share
with other accounts that is in this case
Select properties, go to the permissions tab
Then select "Create and Delete files" in the drop-down menu of
- Click on
Change Permissions for Enclosed filesand select "read
and write" and "Create and Delete files" in the drop-down menus of
- Click change and Close it. Log out of the account.
- Now log-in into your user account.
- Open Files manager, go to Others -> Computer -> root -> Downloads.
- You'll find your files here.