LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Changing permissions for folder access in Ubuntu . (https://www.linuxquestions.org/questions/ubuntu-63/changing-permissions-for-folder-access-in-ubuntu-717260/)

gagne.marc 04-06-2009 03:34 PM

Changing permissions for folder access in Ubuntu .
 
I tried to change the permissions for folder access on my Ubuntu 8.10 system so that I would have the same permissions as root in the folders. So I logged in as root, went to the folder, opened up the Properties window and changed, in the permissions tab, the parameters so that my main session was the owner of the folder and that I had full access to the folder (by the way, what does the setting --- do?). I then closed the window, logged out, went back to my main account, and the permissions hadn't changed! I tried it again and again but to no avail. Since I am new, maybe I skipped an important step (maybe I should restart the computer?). Can anybody help me?
Marc

grunt547 04-06-2009 05:40 PM

Try using the command line to get some information. Run "ls -dl [PATH TO DIRECTORY]" to see what the current permissions and owner are. Then you can use chmod and chown to change them around. You can do that while logged in as yourself by using sudo.

For example, take ownership of one of root's folders and give it read-write-execute for me, read-execute for everyone else.
Code:

$ ls -dl ~/files
drwx------ 9 root root 4096 2009-04-06 15:56 files
$ sudo chown grunt547:grunt547 ~/files
[sudo] password for grunt547:
$ chmod 755 ~/files
$ ls -dl ~/files
drwxr-xr-x 9 grunt547 grunt547 4096 2009-04-06 15:56 files
$

Be careful, though, it's easy to blow things away by mistake when root doesn't own them.

alfplayer 04-06-2009 06:04 PM

It's hard to understand Intrepid's folder permissions window and the help provided.

Anyway, if you run
Code:

sudo chmod -R 777 folder
from your main session you change the permissions of the folder you chose, and the permissions of all the files and folders contained in that folder so that every user has full access to all those files, regardless of the users and groups that own those files.

Be careful because changing system files permissions can be dangerous: you can decrease you system's security and make your system or part of your system useless.

tommcd 04-07-2009 02:48 AM

Quote:

Originally Posted by gagne.marc (Post 3500443)
I tried to change the permissions for folder access on my Ubuntu 8.10 system so that I would have the same permissions as root in the folders.

Are you talking about all files and folders? If this is true, then please be advised that this is a huge security risk.
It is your system though; so do what you want.
Your regular user account should only have access to your personal data in your home directory. Everything else should be reserved for root / sudo.

jschiwal 04-07-2009 02:50 AM

Which directory do you want to change the permissions of?

Is it a local directory on your hard drive or a mounted share?

What is the filesystem being used?

If you are mounting a fat32 partition or samba share, use the uid= and gid= options to change the ownership of the mounted partition and the fmask & umask options to change the permissions.

If it is a system directory, then don't muck with the permissions. Some are owned by a system owner and changing the ownership or permissions could cause your system not to run properly. Other changes could leave your system easily compromised.

gagne.marc 04-07-2009 07:49 AM

Okay, thank you everybody. I'll try it later.

gagne.marc 04-08-2009 05:21 PM

I now have another question:
how do I remove permissions (that is return control to root and only root)?

jschiwal 04-08-2009 06:23 PM

You really need to provide exact details so we know what you are talking about.
Which directory? Are you talking about using chmod or are you referring to something other than file permissions?

If these are system directories, leave them alone. Regular users need access to binaries, libraries and configuration files. For other files, such as /etc/shadow, regular users don't have access. These are already set for you and changing them will either break your system or open up vulnerabilities.

tommcd 04-08-2009 07:10 PM

Quote:

Originally Posted by gagne.marc (Post 3502952)
how do I remove permissions (that is return control to root and only root)?

To return ownership to root just reverse what Grunt547 suggested. That is:
Code:

sudo chown -R root:root /folder
Then to change the read, write, and execute permissions use chown:
Code:

sudo chown -R 744 /folder #root can read, write and execute files; users can read them.
sudo chmod -R 755 /folder #root can read, write, and execute files; users can read and execute.

What the numbers mean:
4=read, 2=write, and 1=execute. They can be added, so 4+1=5, which = read and execute. 4+2+1=7, which = read, write, and execute, etc.
In these examples the first number is for the owner. The second for the owners group, and the third for everyone else.
See the man page for chmod for more details. Also see this:
http://www.linux-tutorial.info/modul...ent&pageid=225
Are these system files? If so, you should put the permissions back the way they were. If you are not sure what the permissions should be for the system files you changed then write back.

gagne.marc 04-09-2009 04:16 PM

Quote:

Originally Posted by jschiwal (Post 3503010)
You really need to provide exact details so we know what you are talking about.
Which directory? Are you talking about using chmod or are you referring to something other than file permissions?

I was talking about www/root/. But anyway, it's okay because I don't need it to be open anymore to everyone. I installed phpmyadmin and it won't allow world writable permissions. So thanks your help and I'm sorry I didn't reply earlier to you.

gagne.marc 04-09-2009 04:17 PM

And thank you tommcd, that really helps me. Thanks for all your help, you and everyone else. Thank you.

alessio 08-22-2011 12:07 PM

Help, please.
 
Guys, I am sure this question has been answered a million times, but I cannot for the life of me find a simple answer (I am sure I am to blame :) )

I got tired of Windows and isntalled Ubuntu. I love it.

I have one problem.

I have only one user, it is called "a" (literally).

I have a home/a/music forder with all my music.

For some reason, root is the only one who has access to some of the files and folders.

Me being a windows guy, I googled around and found the command "gksudo "gnome-open /". I run it and it gives me an error, but it runs a file manager all the same, with root credentials. I know, I know, this is the best way to freak linux guys out. I only have music in this PC, no sercurity risk. Shall Anonymous decide to hack it, I'll just reinstall ubuntu :)

So, I have the file manager running with root credentials, I select my "music" forlder, select "a" in permisions and choose "a" in all pull downs and create and delete files whenever possible. Apply to all sub folders and files (or something like that). Then I go into the folders and the folders and files's permisions have not been changed.

So I went into some folders and changed it, but the files inside did not change.

Now I have a nightmare of "root", "a", group "a", group "root" (and all that) all over my music and I cannot copy, move or listen to my tunes.

Is there a way to tell linux that "a" AND "root" are to be allowed to do what ever they please with every single file and folder in my musci folder?

If so, please, please, please, put something I can copy and paste in a terminal window, as I am not linux sabby, and things like "run pkNuke on the /rtr main sub-console" means nothing to me but that I have a lot of catching up to do :)

Cheers,

Alessio

tommcd 08-23-2011 11:30 PM

Quote:

Originally Posted by alessio (Post 4450287)
I have a home/a/music forder with all my music. ...

Is there a way to tell linux that "a" AND "root" are to be allowed to do what ever they please with every single file and folder in my musci folder?

To return control of all files in /home/a/music/ to user "a", try running this command:
Code:

sudo chown -R a:users /home/a/music
This will give control of the ~/music directory to user "a" (Note that "~" is shorthand for your home directory). Also, everyone in the users group "users" would be able to listen to the music. If you are the only user of the system, then the group ownership is not significant; but this should have been the default permissions for everything in your home directory.

You should not change the permissions of any files outside of your home directory.


All times are GMT -5. The time now is 04:13 AM.