Operating System - HP-UX
1832684 Members
2896 Online
110043 Solutions
New Discussion

Re: su - user .........No Shell

 
SOLVED
Go to solution
dattu_1
Regular Advisor

su - user .........No Shell

Hi guys,
i am getting no shell message when i am doing su - user .The users default shell is called /abc/rgf/rtf.sh.......its shell mentioned in systems passwd file....

and when i run grep zxw /etc/passwd | od -x
i get 00000...what is this....And when i login throgh his id the window gets closed after entering password..........plz help me its urgent...............
12 REPLIES 12
spex
Honored Contributor

Re: su - user .........No Shell

dattu,

The user shell listed in /etc/passwd for must be valid, and must appear in /etc/shells.

PCS
Jaime Bolanos Rojas.
Honored Contributor

Re: su - user .........No Shell

Dattu,

Those are the shells that you might want to use:

#ll /usr/bin/ksh /usr/bin/sh /usr/bin/csh
-r-xr-xr-x 1 bin bin 155648 Jun 21 2004 /usr/bin/csh
-r-xr-xr-x 2 bin bin 159744 Jul 14 2004 /usr/bin/ksh
-r-xr-xr-x 2 bin bin 204800 Oct 21 2003 /usr/bin/sh

For more information, please refer to this old thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1042841

Regards,

Jaime.
Work hard when the need comes out.
sudhapage
Regular Advisor

Re: su - user .........No Shell

May you can check with 'pwck' command. It will check and tell what are all the errors you have in /etc/passwd file.

Regards,
Sudhakaran.K
dattu_1
Regular Advisor

Re: su - user .........No Shell

hi spex,
Actually i need to access an applicn with help of script /abc/def/Mydef.sh ...And what do u mean by shell is valid or not..please explain.......when the user logs in..he gets an menu....
And reg pwck shows some login directories not found and everything ok.....
grpck gives nothing.........


spex
Honored Contributor
Solution

Re: su - user .........No Shell

dattu,

By valid shell, I mean an actual shell--not a shell script. Furthermore, the shell executable must have appropriate ownership/permissions. Examples of valid shells:

# cat /etc/shells
/usr/bin/csh
/usr/bin/ksh
/usr/bin/sh
/sbin/sh

To force a user to use a front-end program:

1) Make sure the user has a valid shell assigned in /etc/passwd (e.g. /usr/bin/sh).

2) Add a reference to the front-end script to ~user/.profile:
exec abc/rgf/rtf.sh
exit

3) Optionally:
# chown root:root ~user/.profile
so that the user cannot make changes.

'exec' replaces the user's current environment with that of and exits once terminates.

PCS


Carles Viaplana
Valued Contributor

Re: su - user .........No Shell

Hello,

Check if user has read privileges to .profile and .login files.

Regards,

Carles
KapilRaj
Honored Contributor

Re: su - user .........No Shell

Give him a valid shell in the /etc/passwd file. If you need to bring up a menu when he logs in, It can be achieved by a .profile or some tweaking in /etc/profile(not recommended)

Regds,

Kaps

But guys, It should work in any case though it is a shell script right ?.
Nothing is impossible
dattu_1
Regular Advisor

Re: su - user .........No Shell

Hi guys,
I think my password file is corrupt....B'coz i have ftp'd this file from the server where the backup was kept..now i am planning to create all users agin through script....Let us see.....I will surely let u know the status..........
spex
Honored Contributor

Re: su - user .........No Shell

Kapil,

Technically, you can set a user's shell to a script, as long as the script is +x and has correct ownership. However, this is not recommended.

PCS
dattu_1
Regular Advisor

Re: su - user .........No Shell

Hi spex,
Actually i am able to access the shell when using telnet ..but when i try to login through ssh i am not able 2 login....the window just opens and gets killed immediately...............
KapilRaj
Honored Contributor

Re: su - user .........No Shell

uhmm that sounds like ssh is not allowing a connection which has a bad shell. Why not try adding (appending) this shell script on /etc/shells and give it a try ?

Regds,

Kaps
Nothing is impossible
dattu_1
Regular Advisor

Re: su - user .........No Shell

Hi Kapil,
Actually the scripts entry is already therein /etc/shells......what should be the permission for /etc/shells.......