3

I have a file that is only visible in root mode. I want to make it visible for non-root users. I added permissions such that the maximum of person can read, write and execute it (even if only read would be necessary) but it is still invisible in non-root (standard) mode. Permissions are as follow for this file (filename.tar.gz)

-rwxrwxr-x 1 root root 2335154 Jan 4 22:55 filename.tar.gz

How can I make this file visible in non-root mode?

  • copy your file to another location (use cp command ) and see if it's become visible. if not try to change its extension from tar.gz to something else and check the changes and reply any changes. – αғsнιη Jan 6 '15 at 7:48
4

Try changing the owner or the group of the file.

sudo chgrp "group name" "filename"   
sudo chown "username" "filename"

But this should only be done, if the file is not exactly required to be "owned" by the root.

  • Here is what I get. Unfortunately, the problem still remains. You can see on the folder on the left the Desktop folder for non-root users, and on the right the same Desktop folder but for root user. – Alexandre Willame Jan 6 '15 at 7:12
1

Changing permission for just the file won't do. You need to allow access for the non-root user to all folders in the parent tree of the file in question.

This of course is a security hazard. So, it is recommended that you try to solve the "need" of accessing this file in a secure way.

1
sudo chmod -R ug+rw foldername

If you want to change all files and folders use:

sudo chmod -R ug+rw *

You can change all these to be owned by the myuser user with:

sudo chown -R myuser:myuser *
  • I tried your hint but I still get the same problem. Here is what I get. You can see on the folder on the left the Desktop folder for non-root users, and on the right the same Desktop folder but for root user. – Alexandre Willame Jan 6 '15 at 7:11
0

I managed to solve the problem. It happened that I have put the file on the Desktop folder, but the root folder named Desktop is completely different from the non-root folder Dektop (which is what is displayed on the desktop of Ubuntu). I copied the file by cd into the folder of the file, and using

cp filename.tar.gz ~/../home/username/Desktop/rosfile.tar.gz

filename being the name of the file, and username being the name of the user. The rights for non-root modification of the file is achieved using

sudo chown "username" "filename"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.