Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 需要通过脚本在solaris上编辑sudoer的帮助吗_Shell_Unix_Scripting - Fatal编程技术网

Shell 需要通过脚本在solaris上编辑sudoer的帮助吗

Shell 需要通过脚本在solaris上编辑sudoer的帮助吗,shell,unix,scripting,Shell,Unix,Scripting,#cat/usr/local/etc/sudoers | grep-i unix unix ALL=(ALL)NOPASSWD:ALL 根测试: sed-i-e的/^\s*(unix\sALL=(ALL)\n密码:\s*ALL)/#\1/'/usr/local/etc/sudoers sed:非法选项--i 根测试: 我也试过了,它也不起作用 sed: illegal option -- i root on test:</tmp> root on测试: $sudo perl-pi

#cat/usr/local/etc/sudoers | grep-i unix unix ALL=(ALL)NOPASSWD:ALL 根测试:

sed-i-e的/^\s*(unix\sALL=(ALL)\n密码:\s*ALL)/#\1/'/usr/local/etc/sudoers
sed:非法选项--i
根测试:
我也试过了,它也不起作用

sed: illegal option -- i
root on test:</tmp>
root on测试:
$sudo perl-pi-e's/^\s*\(unix\s*ALL=(ALL)\s*NOPASSWD:\s*ALL\)/#\1/'/usr/local/etc/sudoers
根测试:
cat/usr/local/etc/sudoers | grep-i unix
unix ALL=(ALL)NOPASSWD:ALL
sed-i-e的/^\s*\(unix\s*ALL=(ALL)\s*NOPASSWD:\s*ALL\)/\35;\ 1/'/usr/local/etc/sudoers,但相同的脚本在linux上工作

我想通过scrit#cat/usr/local/etc/sudoers | grep-i unix unix ALL=(ALL)NOPASSWD:ALL root on test:#sed-i+'s/^\s*(unix\sALL=(ALL)\sNOPASSWD:\s*ALL)/#\1/'/usr/local/etc/sudoers sed:invalical option--i root on test:i想通过脚本#cat/usr/local/etc/sudoers | grep-i unix unix ALL=(ALL)NOPASSWD:ALL root on test:#sed-i+'s/^\s*(unix\sALL=(ALL)\sNOPASSWD:\s*ALL)/#\1/'/usr/local/etc/sudoers sed:invalique选项--我在测试中root:i获得非法选项错误
sed: illegal option -- i
root on test:</tmp>
root on test: </tmp>
$ sudo perl -pi -e 's/^\s*\(unix\s*ALL=(ALL)\s*NOPASSWD:\s*ALL\)/#\1/' /usr/local/etc/sudoers

root on test: </tmp>
cat /usr/local/etc/sudoers |grep -i unix
unix   ALL=(ALL) NOPASSWD: ALL


sed -i -e 's/^\s*\(unix\s*ALL=(ALL)\s*NOPASSWD:\s*ALL\)/#\1/' /usr/local/etc/sudoers but the same script is working on linux