我在Ubuntu中有一个名为var="1973251922:197325192278:abcdefgh:0xfff689990:Searching done for the string:SUCCESS."
echo "$var"
1973251922:197325192278:abcdefgh:0xfff689990:Searching done for the string:SUCCESS.
echo "$var" | awk -F":" '{$1=$2=$3=$4="";sub(/^:+/,"");print $0}' OFS=":"
Searching done for the string:SUCCESS.
的用户帐户。然后我创建了另一个名为my_account
的帐户。当我在test_account
中进行wget时,它可以工作:
my_account
但是当我在my_account@my_machine:~$ wget --no-check-certificate https://hdfs_server:50470/webpage.html#tab-datanode
--2018-02-09 14:37:30-- https://hdfs_server:50470/webpage.html
Resolving hdfs_server (hdfs_server)... 192.168.xx.xx
Connecting to hdfs_server (hdfs_server)|192.168.xx.xx|:50470... connected.
WARNING: cannot verify hdfs_server's certificate, issued by ‘CN=abc CA3,DC=def,DC=ghi,DC=org,DC=jkl’:
Self-signed certificate encountered.
WARNING: cannot verify hdfs_server's certificate, issued by ‘CN=abc CA3,DC=def,DC=ghi,DC=org,DC=jkl’:
Self-signed certificate encountered.
HTTP request sent, awaiting response... 200 OK
Length: 13320 (13K) [text/html]
Saving to: ‘webpage.html’
webpage.html 100%[===================>] 13.01K --.-KB/s in 0.002s
2018-02-09 14:37:30 (5.33 MB/s) - ‘webpage.html’ saved [13320/13320]
中进行wget时,会出现此错误:
test_account
我使用test_account@my_machine:~$ wget --no-check-certificate https://hdfs_server:50470/webpage.html#tab-datanode
--2018-02-09 14:29:52-- https://hdfs_server:50470/webpage.html
Resolving hdfs_server (hdfs_server)... 192.168.xx.xx
Connecting to hdfs_server (hdfs_server)|192.168.xx.xx|:50470... connected.
WARNING: cannot verify hdfs_server's certificate, issued by ‘CN=abc CA3,DC=def,DC=ghi,DC=org,DC=jkl’:
Self-signed certificate encountered.
HTTP request sent, awaiting response... 200 OK
Length: 13320 (13K) [text/html]
webpage.html: Permission denied
Cannot write to ‘webpage.html’ (Success).
作为超级用户(即test_account
)。那么,为什么不能用su test_account
将文件写入系统?我该如何解决?
答案 0 :(得分:0)
我找到了原因。事实证明,test_account
创建后sudo useradd -m -d /home/test_account test_account
未正确设置my_account
,test_Account
和my_Account@my_machine:~$ ls -la
total 120
drwxr-xr-x 30 root root 4096 Feb 7 16:02 .
drwxr-xr-x 26 root root 4096 Jan 28 06:44 ..
drwxr-xr-x 4 1026 1026 4096 Feb 9 14:12 test_account
drwxr-xr-x 23 my_account my_account 4096 Feb 9 14:37 my_account
之间的所有者之间存在差异:
test_account
可以看出,my_Account
没有任何所有者,而my_Account@my_machine:~$ su - root
Password:
root@my_machine:/home# chown test_account:test_account test_account
则拥有。所以,为了解决这个问题,我做了以下几点:
test_account
在此之后,我们可以看到root@my_machine:/home# ls -la | grep test_account
drwxr-xr-x 4 test_account test_account 4096 Feb 9 14:12 test_account
root@my_machine:/home# exit
exit
my_account@my_machine:~$ exit
logout
test_account@my_machine:~$ wget --no-check-certificate https://hdfs_server:50470/webpage.html#tab-datanode
--2018-02-09 14:37:30-- https://hdfs_server:50470/webpage.html
Resolving hdfs_server (hdfs_server)... 192.168.xx.xx
Connecting to hdfs_server (hdfs_server)|192.168.xx.xx|:50470... connected.
WARNING: cannot verify hdfs_server's certificate, issued by ‘CN=abc CA3,DC=def,DC=ghi,DC=org,DC=jkl’:
Self-signed certificate encountered.
WARNING: cannot verify hdfs_server's certificate, issued by ‘CN=abc CA3,DC=def,DC=ghi,DC=org,DC=jkl’:
Self-signed certificate encountered.
HTTP request sent, awaiting response... 200 OK
Length: 13320 (13K) [text/html]
Saving to: ‘webpage.html’
webpage.html 100%[===================>] 13.01K --.-KB/s in 0.002s
2018-02-09 14:58:01 (5.26 MB/s) - ‘webpage.html’ saved [13320/13320]
属于正确的组,并且wget有效:
{{1}}
以为我应该发布我的解决方案,以防有人遇到同样的问题可能会发现它。