LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 04-06-2009, 03:34 PM   #1
gagne.marc
LQ Newbie
 
Registered: Feb 2009
Distribution: Ubuntu
Posts: 21

Rep: Reputation: 16
Question 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
 
Old 04-06-2009, 05:40 PM   #2
grunt547
Member
 
Registered: Nov 2006
Distribution: FreeBSD, OpenBSD
Posts: 30

Rep: Reputation: Disabled
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.
 
Old 04-06-2009, 06:04 PM   #3
alfplayer
LQ Newbie
 
Registered: Mar 2009
Location: Ciudad de Buenos Aires, Argentina
Distribution: Parabola GNU/Linux-libre
Posts: 23

Rep: Reputation: 0
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.
 
Old 04-07-2009, 02:48 AM   #4
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
Quote:
Originally Posted by gagne.marc View Post
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.

Last edited by tommcd; 04-07-2009 at 02:50 AM.
 
Old 04-07-2009, 02:50 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.

Last edited by jschiwal; 04-07-2009 at 03:02 AM.
 
Old 04-07-2009, 07:49 AM   #6
gagne.marc
LQ Newbie
 
Registered: Feb 2009
Distribution: Ubuntu
Posts: 21

Original Poster
Rep: Reputation: 16
Okay, thank you everybody. I'll try it later.
 
Old 04-08-2009, 05:21 PM   #7
gagne.marc
LQ Newbie
 
Registered: Feb 2009
Distribution: Ubuntu
Posts: 21

Original Poster
Rep: Reputation: 16
I now have another question:
how do I remove permissions (that is return control to root and only root)?
 
Old 04-08-2009, 06:23 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 04-08-2009, 07:10 PM   #9
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
Quote:
Originally Posted by gagne.marc View Post
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.

Last edited by tommcd; 04-08-2009 at 07:14 PM.
 
Old 04-09-2009, 04:16 PM   #10
gagne.marc
LQ Newbie
 
Registered: Feb 2009
Distribution: Ubuntu
Posts: 21

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by jschiwal View Post
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.
 
Old 04-09-2009, 04:17 PM   #11
gagne.marc
LQ Newbie
 
Registered: Feb 2009
Distribution: Ubuntu
Posts: 21

Original Poster
Rep: Reputation: 16
And thank you tommcd, that really helps me. Thanks for all your help, you and everyone else. Thank you.
 
Old 08-22-2011, 12:07 PM   #12
alessio
LQ Newbie
 
Registered: Aug 2011
Posts: 3

Rep: Reputation: Disabled
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

Last edited by alessio; 08-22-2011 at 12:19 PM.
 
Old 08-23-2011, 11:30 PM   #13
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
Quote:
Originally Posted by alessio View Post
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.

Last edited by tommcd; 08-23-2011 at 11:33 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing permissions of folder and subdirectories esc_5p1d0r Linux - Newbie 4 01-13-2007 02:39 PM
Changing Permissions in Win98 Folder brianZA Red Hat 3 01-03-2007 02:33 AM
Changing Permissions on Root Folder acascianelli Linux - General 1 08-04-2006 03:28 PM
Having problems changing permissions on a folder zener Linux - Security 16 12-19-2005 09:32 AM
Changing permissions of mounted folder of XP box owain Linux - Networking 1 06-12-2004 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration