在脚本中激活SU而不必输入密码。 [英] Activating SU in a script and not having to enter the password.

查看:439
本文介绍了在脚本中激活SU而不必输入密码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将其转到我可以更改文件权限的位置,以便任何人都可以读取sed文件;但是根文件正在打印文件。只能通过root更改。我创建了一个脚本但它仍然需要一个密码&我希望它不需要密码。

我的剧本


for /home/mmkmmk3/history/*.txt

do

chmod 777 $ file>> results.out

完成


现在我可以绕过必须输入密码吗?我知道通过脚本输入自动root密码的风险,所以我不需要就此进行演讲,请注意。一个很好的解决方案会很好!

I''m trying to make it to where I can change the permissions of a file so that anyone can read sed file; however the file is being printed by the root & can only be changed via the root. I created a script but it still needs a password & I would like it to where a password is not required.
My Script

for file in /home/mmkmmk3/history/*.txt
do
chmod 777 $file >> results.out
done

Now is there anyway I can bypass having to enter in any password? I know the risk of an automated root password enter via a script so I don''t need a lecture on that, mind you. A nice fix would be nice!

推荐答案

file>> results.out

完成


现在我可以绕过必须输入密码吗?我知道通过脚本输入自动root密码的风险,所以我不需要就此进行演讲,请注意。一个很好的解决方案会很好!
file >> results.out
done

Now is there anyway I can bypass having to enter in any password? I know the risk of an automated root password enter via a script so I don''t need a lecture on that, mind you. A nice fix would be nice!


不熟悉我的方法,但一些解决方法可能是:


1)在root下使用cron作业每隔一段时间运行一次(每晚,每小时,你喜欢的间隔)并重置该目录中的权限chmod 777 /home/mmkmmk3/history/*.txt

>
2)使用设置了SSH密钥的另一个系统,因此没有身份验证,并从那里以root身份运行


和一个非常不安全的解决方法将是


3)重置root'的umask以使------ rwx set这意味着root创建的任何文件对系统中的每个用户都是可见的,并且可以很容易创建漏洞
Not familiar with a way to do that off the top of my head, but a few workarounds might be:

1) Use a cron job under root to run every so often (nightly, hourly, your preferred interval) and reset the permissions in that directory chmod 777 /home/mmkmmk3/history/*.txt

2) use another system with SSH keys set up so there''s no authentication, and run it as root from there

and a horribly insecure workaround would be

3) reset root''s umask to have ------rwx set This will mean that ANY file created by root will be visible to every user on the system and can easily create vulnerabilities


第三个可以工作,你能解释一下吗?我理解风险,但这些文件对其他任何人都毫无价值。


第一个,我不知道什么是cron工作,你还可以扩展它。很抱歉这么陌生
That third one would work, could you explain it some more. I understand the risk but these files are worthless to anyone else.

The first one, I don''t know what a cron job is, could you also expand on that. Sorry for being so unfamiliar


这篇关于在脚本中激活SU而不必输入密码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆