Results 1 to 17 of 17
Hybrid View
-
05-23-2006, 07:57 AM #1Eternal Member
- Join Date
- Jan 2002
- Location
- Toronto, Canada
- Posts
- 11,052
How to change file ownership in SSH?
I have a few files that have root as owner. I'm having trouble finding the SSH command to change ownership to a specific user. I logged in as root and entered
chown -R newusername *
but it doesn't do anything.
What is the proper command?
VitoDemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials
-
05-23-2006, 08:22 AM #2WHT Addict
- Join Date
- May 2006
- Posts
- 134
chown to change the username
chgrp to change the group
-R makes it recursive
If you want to change all files and subdirectories in the current folder:
chown -R username *
chgrp -R group *
(group is usually the same as the username)
Or just to change permissions:
chmod -R xxx *
-
05-23-2006, 08:26 AM #3Eternal Member
- Join Date
- Jan 2002
- Location
- Toronto, Canada
- Posts
- 11,052
Perfect, thank you. I had tried chown -R username * , but I was missing chgrp -R group *.
Thanks again.
VitoDemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials
-
05-23-2006, 08:58 AM #4Web Hosting Master
- Join Date
- Nov 2001
- Location
- Vancouver
- Posts
- 2,422
or, use chown to do both
chown -R ownername:groupname *
or one at a time
chown -R ownername *
chown -R :groupname *
More importantly:
man chown“Even those who arrange and design shrubberies are under
considerable economic stress at this period in history.”
-
05-23-2006, 12:58 PM #5Eternal Member
- Join Date
- Jan 2002
- Location
- Toronto, Canada
- Posts
- 11,052
Originally Posted by mwatkins
VitoDemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials
-
05-23-2006, 01:13 PM #6Arbeitsloser
- Join Date
- Mar 2005
- Location
- Cardboard box
- Posts
- 1,027
man typically displays the manual of what follows.
-
05-23-2006, 01:17 PM #7Eternal Member
- Join Date
- Jan 2002
- Location
- Toronto, Canada
- Posts
- 11,052
Ah, haha, I see. Good point.
VitoDemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials
-
05-23-2006, 01:34 PM #8Web Hosting Master
- Join Date
- Nov 2001
- Location
- Vancouver
- Posts
- 2,422
vito - I included that there not to chide you but to remind you that man is an incredibly useful tool. Before I start googling and long before I ask other people for answers, man is my first stop.
Can't remember the various options for chmod? man chmod
Forget string formatting parameters in PHP or Python or C? man sprintf will probably get you there.“Even those who arrange and design shrubberies are under
considerable economic stress at this period in history.”
-
05-23-2006, 03:02 PM #9Aspiring Evangelist
- Join Date
- Dec 2005
- Posts
- 368
And if you forget the correct man syntax, "man man" will help you out!
Of course you need to be secure in your manhood before you can type commands such as "man touch" or "man yum".
-
05-23-2006, 03:08 PM #10Eternal Member
- Join Date
- Jan 2002
- Location
- Toronto, Canada
- Posts
- 11,052
Originally Posted by tobiasly
VitoDemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials
-
05-23-2006, 03:05 PM #11Eternal Member
- Join Date
- Jan 2002
- Location
- Toronto, Canada
- Posts
- 11,052
No worries, mwatkins. I didn't take your post to be negative at all. I never knew about that command so that will definitely help in future.
VitoDemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials
-
05-23-2006, 03:17 PM #12Web Hosting Master
- Join Date
- Nov 2001
- Location
- Vancouver
- Posts
- 2,422
vito:
tobiasly: LOL!“Even those who arrange and design shrubberies are under
considerable economic stress at this period in history.”
-
06-02-2006, 05:47 PM #13Junior Guru Wannabe
- Join Date
- Jun 2006
- Location
- Colorado
- Posts
- 55
Okay, I was doing this earlier...I could change the owner of a directory, but it would not change the owner of the directories' contents.
I was doing:
chown username. directory
To get the directory and its contents, would I just do:
chown username. directory/*
or do I go into the directory that I want to change ownership to and just do
chown username. *Last edited by bdmorrison; 06-02-2006 at 05:53 PM.
-
06-02-2006, 06:21 PM #14Arbeitsloser
- Join Date
- Mar 2005
- Location
- Cardboard box
- Posts
- 1,027
So you are trying to issue the command recursively? Try chown --recursive or chown -R, instead of just chown.
-
06-02-2006, 06:33 PM #15Junior Guru Wannabe
- Join Date
- Jun 2006
- Location
- Colorado
- Posts
- 55
so chown -R will change the owner of the directory and its contents?
Thanks!
-
06-02-2006, 06:54 PM #16Arbeitsloser
- Join Date
- Mar 2005
- Location
- Cardboard box
- Posts
- 1,027
Originally Posted by bdmorrison
You can use chown -Rv (recursive + verbose) to see the files processed. This will help you better understand how it works. Good luck.
-
06-02-2006, 06:41 PM #17WHT Addict
- Join Date
- Apr 2005
- Location
- Holland
- Posts
- 124
-R option will change given directory _and_ everything in it!
Aleks