Just messed up a server misusing chown, how to execute it correctly?
I'm moving from an old shared host to a dedicated server at MediaTemple. The server is running Plesk CP, but, as far as I can tell, there's no way via the Interface to do what I want to do.
On the old shared host, running cPanel, I creative a .zip archive of all the website's files. I downloaded this to my computer, then uploaded it with FTP to the new host account I'd set up.
Finally, I logged in via SSH, navigated to the directory the zip was stored in (something like var/www/vhosts/mysite.com/httpdocs/
and ran the unzip
command on the file sitearchive.zip
. This extracted everything just the fine. The site appeared to work just fine.
The problem: When I tried to edit a file through FTP, I got Error - 160: Permission Denied.
When I Get Info for the file I'm trying to edit, it says the owner and group is swimwir1
.
I attemped to use chown
at this point to change owner - and yes, as you may be able to tell, I'm a little inexperienced in SSH ;) luckily the server was new, since the command I ran - chown -R newuser /
appeared to mess a load of stuff up. The reason I used /
on the end rather than /var/www/vhosts/mysite.com/httpdocs/
was because I'd already cd
ed into their, so I presumed the /
was relative to where I was working. This may be开发者_运维技巧 the case, I have no idea, either way - Plesk was no longer accessible, although Apache and things continued to work. I realised my mistake, and deciding it wasn't worth the hassle of 1) being an amateur and 2) trying to fix it, I just reprovisioned the server to start afresh.
So - what do I do to change the owner of these files correctly?
Thanks for helping out a confused beginner!
Jack
Your command does indeed specify an absolute path to the root of the filesystem. Any path that begins with a '/' is absolute. You need:
chown -R newuser .
or:
chown -R newuser /var/www/vhosts/mysite.com/httpdocs
精彩评论