刚刚误用 chown 搞乱了服务器,如何正确执行它?

发布于 2024-10-08 07:18:44 字数 922 浏览 6 评论 0原文

我正在从旧的共享主机迁移到 MediaTemple 的专用服务器。服务器正在运行 Plesk CP,但是据我所知,无法通过接口执行我想做的事情。

在运行 cPanel 的旧共享主机上,我创建了网站所有文件的 .zip 存档。我将其下载到我的计算机上,然后通过 FTP 将其上传到我设置的新主机帐户。

最后,我通过 SSH 登录,导航到存储 zip 的目录(类似于 var/www/vhosts/mysite.com/httpdocs/ )并运行 unzip文件 sitearchive.zip 上的命令提取了所有内容,该网站似乎工作正常

问题:当我尝试通过 FTP 编辑文件时,我收到错误 - 160:权限被拒绝。当我获取要编辑的文件的信息时,它显示所有者和组是swimwir1

chown 此时要更改所有者 - 是的,正如您可能知道的那样,我对 SSH 有点缺乏经验;)幸运的是,服务器是新的,因为我运行了命令 - chown -R newuser / 似乎把一堆东西搞乱了。我最后使用 / 而不是 /var/www/vhosts/mysite.com/httpdocs/ 的原因是因为我已经 cd > 进入他们的,所以我推测 / 与我工作的地方相关。情况可能是这样,我不知道,无论怎样 - Plesk 不再可以访问,尽管 Apache 和其他东西继续工作。我意识到我的错误,并认为不值得为 1) 作为业余爱好者和 2) 尝试修复它而烦恼,我只是重新配置服务器以重新开始。

那么 - 我该怎么做才能正确更改这些文件的所有者?

感谢您帮助困惑的初学者!

杰克

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 cded 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掩饰不了的爱 2024-10-15 07:18:44

您的命令确实指定了文件系统根目录的绝对路径。任何以“/”开头的路径都是绝对路径。您需要:

chown -R newuser .

或:

chown -R newuser /var/www/vhosts/mysite.com/httpdocs

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文