LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I grant myself super access to files/folders? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-grant-myself-super-access-to-files-folders-4175540243/)

xmrkite 04-20-2015 12:37 PM

How do I grant myself super access to files/folders?
 
Here is an output example when I run ls -l

drwx------ 24 user1 user1 4096 Dec 7 21:00 folder1
drwxrwxrwx 6 user1 user1 4096 Apr 18 20:36 folder2


I am able to browse folder2 just fine but not folder1 unless I open my file manager with sudo.

Is there a way to somehow grant myself access to everything? It's my system and I want to view all files on the system. I should be able to get into folder1 without having to fire up the file manager using sudo.

whm1974 04-20-2015 12:46 PM

Quote:

Is there a way to somehow grant myself access to everything? It's my system and I want to view all files on the system. I should be able to get into folder1 without having to fire up the file manager using sudo.
Not a good ideal. There are good reasons why sudo is there and why you shouldn't be logged in as root all the time.

T3RM1NVT0R 04-20-2015 01:03 PM

Quote:

Here is an output example when I run ls -l

drwx------ 24 user1 user1 4096 Dec 7 21:00 folder1
drwxrwxrwx 6 user1 user1 4096 Apr 18 20:36 folder2


I am able to browse folder2 just fine but not folder1 unless I open my file manager with sudo.
Which user account are you using to access folder1? If it is user1 then I doubt you will have any trouble accessing folder1. However, if you are using any other account to access folder1 then it will get blocked because the permission is set to 700 which mean only owner has got full access, group and other have no access to it. That is the reason you have to use sudo to get into folder1.

You are able to get into folder2 without any issues because permissions on folder2 is set to 777 which means owner, group and others have got full access to folder2 and anyone can get in.

Quote:

Is there a way to somehow grant myself access to everything? It's my system and I want to view all files on the system. I should be able to get into folder1 without having to fire up the file manager using sudo.
It appears to me that folder1 and folder2 both are under user1 home directory. Granting other account access to it is not a good deal in real world scenarios. Usually when such requirements come we go with setting up sgid on a shared folder located outside users home directory.

As this is your test server or the server on which you are trying to do R&D you have got two options:

1. Setup ACL, which is kind of messy if you are trying to set it up on multiple directories. Basically troubleshooting file permission issues with ACL on will drive you crazy.

2. Give permission to others, I wouldn't suggest giving write permission but just allow browsing. You can do that by executing the following command:

Code:

sudo chmod -R 755 folder1
Running with -R so that any folders under folder1 will also get same permission recursively.

veerain 04-20-2015 01:11 PM

You can give folder1 group permission rwx and make the filemanager user a member of that group.

xmrkite 04-20-2015 01:16 PM

The main thing I am actually just trying to do is to backup the folder using rsyinc over ssh to another system but I am getting permission denied messages. User1 is not me.

Sudo chmod -R 755 would work, but not if they keep adding folders here or there. I'd have to do that each and every time I run the backup. Can I run rsync over ssh but use sudo? Will that run sudo on the remote computer too or just locally?

ie... sudo rsync -azvr ssh user2@server:/media/files /home/user2/backup

Right now I run something like: rsync -azvr ssh user2@server:/media/files /home/user2/backup

But what happens from time to time is users ask me to take a look at their files for help here or there and it's a pain to pop up a sudo file manager, so I'm hoping to find a way around it.


All times are GMT -5. The time now is 11:45 PM.