Change visibility of files for non-root users

9,719

Solution 1

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"

Solution 2

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.

Solution 3

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 *

Solution 4

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.

Share:
9,719

Related videos on Youtube

Alexandre Willame
Author by

Alexandre Willame

Updated on September 18, 2022

Comments

  • Alexandre Willame
    Alexandre Willame over 1 year

    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?

    • αғsнιη
      αғsнιη over 9 years
      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.
  • Alexandre Willame
    Alexandre Willame over 9 years
    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
    Alexandre Willame over 9 years
    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.