hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : How to change file ownership in SSH?
Reply

Forum Jump

How to change file ownership in SSH?

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old
Eternal Member
 
Join Date: Jan 2002
Location: Toronto, Canada
Posts: 11,059

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?

Vito

__________________
DemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials



Sponsored Links
  #2  
Old
WHT Addict
 
Join Date: May 2006
Posts: 130
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 *

  #3  
Old
Eternal Member
 
Join Date: Jan 2002
Location: Toronto, Canada
Posts: 11,059
Perfect, thank you. I had tried chown -R username * , but I was missing chgrp -R group *.

Thanks again.

Vito

__________________
DemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

Sponsored Links
  #4  
Old
Web Hosting Master
 
Join Date: Nov 2001
Location: Vancouver
Posts: 2,416
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.”

  #5  
Old
Eternal Member
 
Join Date: Jan 2002
Location: Toronto, Canada
Posts: 11,059
Quote:
Originally Posted by mwatkins

More importantly:

man chown
Sorry, I'm confused. What is that command for?

Vito

__________________
DemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

  #6  
Old
Arbeitsloser
 
Join Date: Mar 2005
Location: Cardboard box
Posts: 1,023
man typically displays the manual of what follows.

__________________
distrACT -- an open community

  #7  
Old
Eternal Member
 
Join Date: Jan 2002
Location: Toronto, Canada
Posts: 11,059
Ah, haha, I see. Good point.

Vito

__________________
DemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

  #8  
Old
Web Hosting Master
 
Join Date: Nov 2001
Location: Vancouver
Posts: 2,416
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.”

  #9  
Old
Aspiring 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".

  #10  
Old
Eternal Member
 
Join Date: Jan 2002
Location: Toronto, Canada
Posts: 11,059
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

__________________
DemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

  #11  
Old
Eternal Member
 
Join Date: Jan 2002
Location: Toronto, Canada
Posts: 11,059
Quote:
Originally Posted by tobiasly
Of course you need to be secure in your manhood before you can type commands such as "man touch" or "man yum".
[*...clears voice...burps a couple of times...swears for no reason...OK, I'm ready.../*]



Vito

__________________
DemoDemo.com - Flash tutorials since 2002
DemoWolf.com - 5,300+ Flash tutorials for hosting companies, incl. Voice tutorials

  #12  
Old
Web Hosting Master
 
Join Date: Nov 2001
Location: Vancouver
Posts: 2,416
vito:

tobiasly: LOL!

__________________
“Even those who arrange and design shrubberies are under
considerable economic stress at this period in history.”

  #13  
Old
Junior Guru Wannabe
 
Join Date: Jun 2006
Location: Colorado
Posts: 54
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.
  #14  
Old
Arbeitsloser
 
Join Date: Mar 2005
Location: Cardboard box
Posts: 1,023
So you are trying to issue the command recursively? Try chown --recursive or chown -R, instead of just chown.

__________________
distrACT -- an open community

  #15  
Old
Junior Guru Wannabe
 
Join Date: Jun 2006
Location: Colorado
Posts: 54
so chown -R will change the owner of the directory and its contents?

Thanks!

Reply

Related posts from TheWhir.com
Title Type Date Posted
The Pirate Bay Co-Founder Faces 8 Months in Prison After Arrest in Sweden Web Hosting News 2014-06-05 09:20:34
Dropbox Suffers Temporary Outage Impacting File Sharing and Synchronizing Web Hosting News 2014-03-14 12:11:46
AeroFS Launches Private File Sharing Software Web Hosting News 2013-11-22 17:00:53
Egnyte Launches Program to PRISM-Proof Enterprise Cloud File-sharing Web Hosting News 2013-09-27 13:45:48
File Sharing Service RapidShare Changes Traffic Model to Deter Piracy Web Hosting News 2012-11-09 12:16:35


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?