ChinaUnix.net
 >> ChinaUnix.net > Solaris

想su到root提示no shell怎么办?

作者:loadysy     发表时间:2002/02/27 03:34pm

我把/etc/passwd文件里的root的/sbin/sh改成/sbin/csh了,就不让su到root了,提示no shell,root的shell不能改吗?我得怎么办啊?各位大虾救救我!

此文章相关评论:
该文章有12个相关评论如下:(点这儿可以发表评论)
newboy 发表于: 2002/02/27 04:18pm
不是不能改,而是系统中原本就没有/sbin/csh,你想用csh应该指定到/bin/csh。
 
hanmeng 发表于: 2002/02/27 04:18pm
试一试su不加“-”可不可以进到root用户
 
shirley 发表于: 2002/02/27 04:24pm
/sbin下没有csh! root的shell是/sbin/sh,不要改!
改回原来那样不就行了吗?

root的shell也不是不能改,但千万不要直接改/etc/passwd文件。可以在root的.profile文件中执行/bin/csh。

注意一下,/sbin/sh和/usr/bin/sh是不同的。/sbin/sh是一个静态连接的二进制程序,而/usr/bin/sh是一个动态连接的程序,它执行的时候需要/usr/lib下的动态库的支持。系统对root的shell做这样的设置,才能保证即使系统运行在单用户模式,root帐户也能够正常工作。

 
loadysy 发表于: 2002/02/27 04:43pm
是啊,我改完才知道根本就没有/sbin/csh的,不过问题已经解决了,到本机竟root可以登陆,hehe~~
su不加“-”也是不行的!
多谢各位!
还有请教shirley,root 的.profile文件找不到,是要自己手工建的吗,是从/etc/skel先考个template过来吗?
 
shirley 发表于: 2002/02/27 04:51pm
从/etc/skel目录拷贝到/目录,然后根据需要修改里边的设置,主要是PATH,MANPATH这些环境变量。
 
bear 发表于: 2002/02/27 08:34pm
谢谢shirley,我们又学了一个基本原理。
 
zcycy 发表于: 2002/02/28 08:38am
/下应该有一个.dtprofile文件,里边是.profile的创建示例,可以参考
 
loadysy 发表于: 2002/02/28 08:57am
谢谢大家~!我还想问一下,我在.profile中的设置,. ./.profile这样可以生效,但在重新连接就不生效了,怎样才能永久生效呢?
 
hanmeng 发表于: 2002/03/01 01:46pm
看看你的SHELL是什么,如果是C shell,则使用.login
 
brandnew 发表于: 2002/11/23 00:26am
完啦,看到这里一篇文章,说在安装Unix后的修改配置,把Root的Shell改成bash,在passwd 文件中改,结果就写成了/sbin/bash
重新用root login,说是no shell, 无法进入,
在本地用root也无法login,其他几个帐号可以登录,可是都不是Superuser,

怎么办?难道我非得重新装Solaris?

多谢!请发一份到:kanata@rogers.com

 
flyingboy 发表于: 2002/11/23 01:34am
我也出现了这个情况,解决办法:
用sun安装盘引导,把硬盘(fsck后)mount到/mnt下,然后vi /mnt/etc/passwd,修改相应的shell。
ok!
 
brandnew 发表于: 2002/11/23 01:38am
刚找到这一段,和楼上的一样:

Good news is, if you are running Solaris 9,
there is fallback shell if you stop the machine
and boot it into single user with boot -s
Bad news, it doesnt work in previous releases.

There you have to take your Solaris CD, put it in
boot with: boot cdrom -s
when its up do a mount:
mount /dev/dsk/c0t0d0s0 /a
set TERM=vi
export TERM
vi /a/etc/shadow

remove everything between first and second colon
so it looks like this
root:: and leave the rest as it were

Have fun *L*

do an: umount /a
and reboot the system

Sorry, no other way to do it

http://www.google.ca/search?q=cache:j8dOZxT71DUC:www.experts-exchange.com/Operating_Systems/Solaris/Q_20311607.html+unix++su+no+shell&hl=en&ie=UTF-8

 
 

Copyright © ChinaUnix.net  *  转载请注明出处及作者