Wordpress安装权限被拒绝,ubuntu

时间:2018-05-12 10:45:06

标签: linux wordpress shell ubuntu

我一直在尝试将wordpress压缩到ubuntu到特定目录

/usr/share/nginx/wp_install/www

但改为拒绝错误权限

wget http://wordpress.org/latest.zip
--2018-05-12 03:26:20--  http://wordpress.org/latest.zip
Resolving wordpress.org (wordpress.org)... 198.143.164.252
Connecting to wordpress.org (wordpress.org)|198.143.164.252|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://wordpress.org/latest.zip [following]
--2018-05-12 03:26:40--  https://wordpress.org/latest.zip
Connecting to wordpress.org (wordpress.org)|198.143.164.252|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9333392 (8.9M) [application/zip]
latest.zip: Permission denied

Cannot write to ‘latest.zip’ (Permission denied).

如何获得写入特定文件夹的权限?

mkdir -P /usr/share/nginx/wp_install/www
wget http://wordpress.org/latest.tar.gz -O /usr/share/nginx/wp_install/www
tar xfp /usr/share/nginx/wp_install www latest.tar.gz

输出:

/usr/share/nginx/wp_install/www: Is a directory
tar: /usr/share/nginx/wp_install/www: Cannot read: Is a directory
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now

而不是-o,使用-p并且它确实下载了文件,但是获得了文件权限问题。

mkdir -p /usr/share/nginx/wp_install/www
wget http://wordpress.org/latest.tar.gz -p /usr/share/nginx/wp_install/www latest.tar.gz
tar xfp /usr/share/nginx/wp_install/www latest.tar.gz

输出:

http://wordpress.org/latest.tar.gz
Resolving wordpress.org (wordpress.org)... 198.143.164.252
Connecting to wordpress.org (wordpress.org)|198.143.164.252|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://wordpress.org/latest.tar.gz [following]
--2018-05-12 06:03:03--  https://wordpress.org/latest.tar.gz
Connecting to wordpress.org (wordpress.org)|198.143.164.252|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8565154 (8.2M) [application/octet-stream]
Saving to: ‘wordpress.org/latest.tar.gz’

wordpress.org/lates 100%[===================>]   8.17M   490KB/s    in 14s     

2018-05-12 06:03:18 (580 KB/s) - ‘wordpress.org/latest.tar.gz’ saved [8565154/8565154]

/usr/share/nginx/wp_install/www/latest.tar.gz: Scheme missing.
FINISHED --2018-05-12 06:03:18--
Total wall clock time: 19s
Downloaded: 1 files, 8.2M in 14s (580 KB/s)
tar: /usr/share/nginx/wp_install/www: Cannot read: Is a directory
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now

1 个答案:

答案 0 :(得分:0)

当你在做wget -o时,你需要具体说明你要编写的文件。

你在哪里:

wget http://wordpress.org/latest.tar.gz -O /usr/share/nginx/wp_install/www

你应该

wget http://wordpress.org/latest.tar.gz -O /usr/share/nginx/wp_install/www/latest.tar.gz