LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 802|回复: 3

关于shell权限继承的问题高手告诉我呀

[复制链接]
发表于 2006-5-28 10:57:40 | 显示全部楼层 |阅读模式
我root的用户shell被我整错我因为着急结果打了两次chsh -l了 结果就导致我的root的默认shell变成了"chsh -l"这个东东哈哈.....理论上如果系统在读取passwd时在shell部分的如果什么都不是..那么会使用默认的bash..但是我这个不知道为什么没有..而且读取chsh -l 不过结果大家都知道是错误咯..所以导致root无法初始化...

然后发生了一件事..我也不甚明白哦..就是我在gnome的yast里吧root的shell改会了/bin/bash 而且进入yast的时候的确也需要root的password认证...这就是个问题..因为shell调用一个程序的时候应该是吧父进程制造一个副本也就是子进程然后用这个子进程调用程序此时程序覆盖子进程的位置也就是shell副本的位置..也就是说此时的程序应该是继承了自己进程的权限和变量等一系列的值.....也就是说...我此时的yast已经继承了root的权限..但是此时root的shell不是正常的值..那么yast是从哪儿继承的root的权限呢..
发表于 2006-5-28 11:45:26 | 显示全部楼层
我想yast只是以root来运行bash,不一定用登录。而sudo,su等则不同。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-28 13:45:08 | 显示全部楼层
但是此时从passwd里读取的shell 已经不是bash咯.....以为被我改坏了么....
回复 支持 反对

使用道具 举报

发表于 2006-5-29 01:54:29 | 显示全部楼层
一般程序调用sudo并不执行login过程。

  1.        -i  The -i (simulate initial login) option runs the shell specified in the passwd(5) entry of
  2.            the user that the command is being run as.  The command name argument given to the shell
  3.            begins with a - to tell the shell to run as a login shell.  sudo attempts to change to
  4.            that user's home directory before running the shell.  It also initializes the environ-
  5.            ment, leaving TERM unchanged, setting HOME, SHELL, USER, LOGNAME, and PATH, and unsetting
  6.            all other environment variables.  Note that because the shell to use is determined before
  7.            the sudoers file is parsed, a runas_default setting in sudoers will specify the user to
  8.            run the shell as but will not affect which shell is actually run.
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表