[求助]请教怎样实现自动作为root免登录进入QNX?

如题,是不是可以改变启动脚本或者什么设置,可以实现自动作为root免登录进入QNX,谢谢!

cp /bin/login /bin/login.backup

cp /bin/ksh /bin/login

shutdown -f

非常感谢唐先生的帮助,不过这对于登录时为终端是有效的,可是对于登录时为photon时仍然出现login的对话框。应该怎样解决呢?谢谢!

http://www.openqnx.com/PNphpBB2-viewtopic-t3219-.html

非常感谢!不愧是版主。我怎么在openqnx上搜索不到呢?

因为那个帖子就是我写的 :slight_smile:
noc=liug

xtang :

cp /bin/ksh /bin/login

我执行这句的时候,有错误:/bin/login resource busy.cannot open。
我是在图形界面下 在terminal运行的。 说这个文件被使用了,我应该怎么做。谢谢

noc:

你的方法:
Assuming you want Photon to be auto started as the new user, say, “myuser”, and your own application is a Photon GUI application called “myapp” located in /usr/bin.


2) create a file /etc/rc.d/rc.local if it is not already there, add the following lines at the end of rc.local

/bin/su - myuser -c “/usr/bin/ph” // 这句是什么意思啊。让myuser以图形界面登陆的意思吗

  1. make sure the /etc/rc.d/rc.local is executable:
    chmod a+x /etc/rc.d/rc.local

  2. In the new user’s home directory: // 这个目录是/home/myuser/吗?
    mkdir -p .ph //这个是创建隐藏目录.ph吗
    cd .ph
    vi phapps //phapps文件是做什么的呢 跟myapp 什么关系啊。
    and add your own application in there: // 添加什么到什么啊
    /usr/bin/myapp & //这句加在rc.local中用于后台启动吧
    save the “phapps” file and make it executable
    chmod a+x phapps //phapp跟myapp什么关系呢,呵呵

还有如果我只想以root身份自动登陆, 然后自动运行/root/myfolder/myapp程序。应该怎么写啊。谢谢。麻烦了!

cp -f /bin/ksh /bin/login

This is start “photon” as user “myuser”.

  1. make sure the /etc/rc.d/rc.local is executable:
    chmod a+x /etc/rc.d/rc.local

  2. In the new user’s home directory: // 这个目录是/home/myuser/吗?

Yes

mkdir -p .ph //这个是创建隐藏目录.ph吗

Yes

cd .ph
vi phapps //phapps文件是做什么的呢 跟myapp 什么关系啊。

read the photon document below, it explains what is “~/.ph/phapps”.
http://www.qnx.com/developers/docs/6.3.0SP2/neutrino/utilities/p/ph.html

and add your own application in there: // 添加什么到什么啊
/usr/bin/myapp & //这句加在rc.local中用于后台启动吧

Add the “/usr/bin/myapp &” into phapps file that you just created.

save the “phapps” file and make it executable
chmod a+x phapps //phapp跟myapp什么关系呢,呵呵

phapps explained in the document above.

还有如果我只想以root身份自动登陆, 然后自动运行/root/myfolder/myapp程序。应该怎么写啊。谢谢。麻烦了!

The above told you how to auto-login and run myapp as user “myuser”, do the same for user “root” if you want to.

非常谢谢xtang先生的详细的解释,我还有一个问题请教一下:

/usr/bin/myapp & 是让程序后台运行,现在我想看程序运行的情况,即看在前台运行时应该显示在stdout上的输出。应该怎么做呢?谢谢

还有 我不想让myapp后台运行,想让它前台运行,所以我把&去了。重启之后,我ps -A 看不到 /usr/bin/myapp这个进程了。请问是怎么个一回事呢?

还有如果我把/usr/bin/myapp& 这句话放到/etc/rc.d/rc.local 里面也能实现自动运行这个myapp程序。这样任意用户登陆都会运行这个程序,请问这样跟放到phapps里面有什么不好的地方或好的地方呢。谢谢!

呵呵,最开始johnsonyoung的问题是如何直接进入photon并运行自己的程序。

如果你的程序不需要photon就可以运行的话,直接放在 /etc/rc.d/rc.local也可以。但是 /etc/rc.d/rc.local是由root来运行的(在login之前)。如果你希望用指定用户ID来执行的话,情形又不一样。

1、/usr/bin/myapp & 是让程序后台运行,如果myapp是循环打印一些输出到stdout.,我想看程序的输出,应该用什么命令看呢?谢谢

2、还有 我不想让myapp后台运行,想让它前台运行,所以我把&去了。重启之后,我ps -A 看不到 /usr/bin/myapp这个进程了。请问是怎么个一回事呢?