Ubuntu/etc/rc.local在没有sudo的情况下无法运行
我有一个问题,当我在/etc/rc.local上添加'ssserver-c/etc/shadowsocks.json-dstart'时,它看起来是这样的:Ubuntu/etc/rc.local在没有sudo的情况下无法运行,ubuntu,Ubuntu,我有一个问题,当我在/etc/rc.local上添加'ssserver-c/etc/shadowsocks.json-dstart'时,它看起来是这样的: #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on er
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
ssserver -c /etc/shadowsocks.json -d start
exit 0
当我重新启动计算机时,它不工作。
但是当我在“ssserver-c/etc/shadowsocks.json-dstart”之前添加sudo时
它将非常有效。
这就是为什么 ssserver需要
sudo
权限
ll/etc/shadowsocks.json
-rw-r--r--1根根根151 Dec 15 20:40/etc/shadowsocks.json
ssserver需要
sudo
权限
ll/etc/shadowsocks.json
-rw-r--r--1根根根151 Dec 15 20:40/etc/shadowsocks.json
无论何时使用
rc.local
,您都不能假定您的命令是自动识别的,因为在某些情况下PATH
变量尚未加载
尝试运行二进制文件的完整路径,而不仅仅是名称。您可以使用
哪个ssserver
从我看到的
shadowsocks.json
文件权限很好,因为所有用户都可以阅读它,如果还需要写入,您可以运行chmod a+w/etc/shadowsocks.json
作为root
或使用sudo
每当使用rc.local
时,您不能假设您的命令是自动识别的,因为在某些情况下,路径
变量尚未加载
尝试运行二进制文件的完整路径,而不仅仅是名称。您可以使用
哪个ssserver
从我所看到的
shadowsocks.json
文件权限很好,因为所有用户都可以读取它,如果还需要写,您可以运行chmod a+w/etc/shadowsocks.json
作为root
或使用sudo关闭主题,尝试关闭主题,尝试使系统文件世界可写从来都不是一个好主意。找出哪些权限是绝对必要的,然后只分配那些权限。让系统文件世界可写从来都不是一个好主意。找出哪些权限是绝对必要的,然后只分配那些权限。
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sudo ssserver -c /etc/shadowsocks.json -d start
exit 0