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?
Vito
Printable View
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?
Vito
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 *
Perfect, thank you. I had tried chown -R username * , but I was missing chgrp -R group *.
Thanks again. :beer:
Vito
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
Sorry, I'm confused. What is that command for?Quote:
Originally Posted by mwatkins
Vito
man typically displays the manual of what follows. :)
Ah, haha, I see. Good point. :)
Vito
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.
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". :)
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.
Vito
[*...clears voice...burps a couple of times...swears for no reason...OK, I'm ready.../*]Quote:
Originally Posted by tobiasly
:D
Vito
vito: :)
tobiasly: LOL!
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. *
So you are trying to issue the command recursively? Try chown --recursive or chown -R, instead of just chown. :)
so chown -R will change the owner of the directory and its contents?
Thanks!
-R option will change given directory _and_ everything in it!
Aleks
Yes.Quote:
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. :)