Java执行需要su的Linux命令? [英] Java execute Linux commands that require su?

查看:1246
本文介绍了Java执行需要su的Linux命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行需要使用su的Linux命令的最佳方式是什么?我希望它非常可靠,因为安全性我不在乎它,系统不是生产服务器。没有人连接到机器,但我自己。我考虑以root身份登录,所以我不必处理su命令,默认情况下它被禁用。我正在使用Debian 6.

What is the best way to run Linux commands that require "su" with Java? I want it to be very reliable, as for security goes I don't care much about it the system is not a production server. No one ever connects to the machine but myself. I thought about logging in as root so I don't have to deal with the su command and its disabled by default. I'm using Debian 6.

唯一的事情是,我的一个要求是程序应该在普通用户登录后开始,而不用进一步用户输入。我将为普通用户设置自动登录,当计算机打开时,普通用户登录后,我希望该Java程序作为sudo su运行,没有任何用户输入。这可能是可能的吗?

The only thing is that one of my requirements is that the program should start after the normal user logs in without any farther user input. I would set auto login for the normal user and when the computer is turned on and after the normal user logs in I would want that Java program to run as sudo, su without any user input. Would that be possible?

请告诉我一个简单可靠的解决方案。

Please tell me a simple and reliable solution.

关心

推荐答案

使用 sudo
它可以配置为允许特定的命令运行而不输入密码。

Use sudo instead. It can be configed to allow specific command run without typing in password.

这篇关于Java执行需要su的Linux命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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