开发者

Best Practice? Restart Centos service via ssh securely?

开发者 https://www.devze.com 2023-04-07 17:58 出处:网络
I have a need to restart a CentOS service remotely via ssh during an automated, unattended process (executing a build on some software from a build server), but am unsure how to best implement securit

I have a need to restart a CentOS service remotely via ssh during an automated, unattended process (executing a build on some software from a build server), but am unsure how to best implement security. Help is needed! ;-)

Environment:

Running an ssh login on a remote box, I want to execute on my server something like:

开发者_开发问答
/sbin/service jetty restart.

The ssh call is being made during a maven build process (probably doesn't affect anything, really).

I want the ssh session to login with a user that has practically zero permissions on the server except to execute the above.

I can set up shared key access for the ssh session.

Thanks!


Good idea to use an ssh key. You can then use a 'forced command' for that particular key, so it won't be able to run any other commands. See http://www.eng.cam.ac.uk/help/jpmg/ssh/authorized_keys_howto.html

0

精彩评论

暂无评论...
验证码 换一张
取 消