root's shell, /sbin/sh, /bin/sh and /usr/ksh

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by Timothy J. L » Sat, 21 Mar 1998 04:00:00



|Our users want to change the root shell to /bin/ksh.

On computers where a user who needs root access wants to use a
shell other than /sbin/sh, one option is to create another root
account with the desired shell.  For example (in the /etc/passwd
file, with corresponding entries in the /etc/shadow file):

root:x:0:1:Super-User:/:/sbin/sh
rootksh:x:0:1:Super-User:/:/usr/bin/ksh

But you do have to remember to change both root passwords when
you want to change the root password.

--
------------------------------------------------------------------------

Unsolicited bulk or commercial email is not welcome.             netcom.com
No warranty of any kind is provided with this message.

 
 
 

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by Philip Isaa » Sat, 21 Mar 1998 04:00:00


How about the user typing in /bin/ksh after logging in as root? It works
in multi-admin groups because some prefer csh, tsch, or bash. Otherwise,
maybe set up a menu in the .profile so they can select a shell when they
log in.

 
 
 

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by Bob McGowa » Sat, 21 Mar 1998 04:00:00


Another option is to put the following lines in the /.profile (assuming
it exists):

### set any generic environment variables and export them
if [ -x /usr/bin/ksh ] ## or whatever shell/path you want
then
        SHELL=ksh # no path needed here
        export SHELL
        exec ksh  # no path needed here either
fi

I have used this for several years now with no negative effects that I
have found.  Setting the SHELL variable inside the if will ensure that
subshells from vi, etc. as well as terminal windows under CDE or
OpenWindows will run your preferred shell.  And when your preferred
shell is not available, you will get the old standby /sbin/sh so
hopefully the best of two worlds.

----
Bob McGowan
i'm bobmcgow at xstor dot com
Storage Dimensions, Inc.

-----Original Message-----


Posted At: Thursday, March 19, 1998 5:50 PM
Posted To: solaris
Conversation: root's shell, /sbin/sh, /bin/sh and /usr/ksh
Subject: Re: root's shell, /sbin/sh, /bin/sh and /usr/ksh


|Our users want to change the root shell to /bin/ksh.

On computers where a user who needs root access wants to use a
shell other than /sbin/sh, one option is to create another root
account with the desired shell.  For example (in the /etc/passwd
file, with corresponding entries in the /etc/shadow file):

root:x:0:1:Super-User:/:/sbin/sh
rootksh:x:0:1:Super-User:/:/usr/bin/ksh

But you do have to remember to change both root passwords when
you want to change the root password.

--
------------------------------------------------------------------------

Unsolicited bulk or commercial email is not welcome.
netcom.com
No warranty of any kind is provided with this message.

 
 
 

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by Uri Guttma » Sat, 21 Mar 1998 04:00:00



> Another option is to put the following lines in the /.profile (assuming
> it exists):

> ### set any generic environment variables and export them
> if [ -x /usr/bin/ksh ] ## or whatever shell/path you want
> then
>    SHELL=ksh # no path needed here
>    export SHELL
>    exec ksh  # no path needed here either
> fi

> I have used this for several years now with no negative effects that I
> have found.  Setting the SHELL variable inside the if will ensure that
> subshells from vi, etc. as well as terminal windows under CDE or
> OpenWindows will run your preferred shell.  And when your preferred
> shell is not available, you will get the old standby /sbin/sh so
> hopefully the best of two worlds.

> On computers where a user who needs root access wants to use a
> shell other than /sbin/sh, one option is to create another root
> account with the desired shell.  For example (in the /etc/passwd
> file, with corresponding entries in the /etc/shadow file):

> root:x:0:1:Super-User:/:/sbin/sh
> rootksh:x:0:1:Super-User:/:/usr/bin/ksh

i have much simpler idea that requires no changes to anything in the
passwd file or .profile

i define this shell function in my personal .bashrc. it should work
under ksh or sh. i have not tried that but it should be easy to fix. the
-login is bash specific and it is needed so you get the root's .bashrc
read. if you don't ant hat you can delete it or change it for another
shell's login force option.

function xtroot() {
      (my_xterm -T root -n root -e su - root -c "exec $SHELL -login" &)

Quote:}

it creates a new xterm with the shell you desire (your current
shell). the su command in the xterm asks you for the password. when you
exit the su, the xterm leaves.

works like a charm!

uri

--
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----  8 Years of Perl Experience, Available Immediately

Use the Best Search Engine on the Net  --------  http://www.northernlight.com

 
 
 

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by Dominic Mitche » Mon, 23 Mar 1998 04:00:00



Quote:> How about the user typing in /bin/ksh after logging in as root? It works
> in multi-admin groups because some prefer csh, tsch, or bash. Otherwise,
> maybe set up a menu in the .profile so they can select a shell when they
> log in.

My favourite is to bind this kind of thing to an xterm F-key sequence.
Here's what goes in the .Xdefaults file:

XTerm*VT100.translations:       #override \n\
        <Key>F3: set-scrollbar(toggle) \n\
        <Key>F4: string("test -x /usr/local/bin/bash && exec bash ; exec ksh\nset -o emacs\n") \n\
        <Key>F5: string("PS1=`uname -n|cut -d. -f1,2`'# '\n")
--
Vibrating Bum-Faced Goats

 
 
 

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by Michael Wa » Thu, 26 Mar 1998 04:00:00


If the rc script ends with sh, then . is used. if it does not end
with sh, then sh is used. My question is, under what shell . is used?
I do not think it is root shell as defined in passwd etc. But again
what shell? Thanks.

                        case ${f} in
                                *.sh)   .        ${f} ;;        # source it
                                *)      /sbin/sh ${f} start ;;  # sub shell
                        esac


Quote:>_exactly_ the same and the Bourne shell itself? Not all of the scripts
>in /etc/init.d and /etc/rc* specify a shell; do any differences between
>sh and ksh really matter?

 
 
 

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by Casper H.S. Dik - Network Security Engine » Thu, 26 Mar 1998 04:00:00


[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]


>If the rc script ends with sh, then . is used. if it does not end
>with sh, then sh is used. My question is, under what shell . is used?
>I do not think it is root shell as defined in passwd etc. But again
>what shell? Thanks.

The "." command is executed inside the incantation of the
shell that runs the current script.  (I.e., you can change directory,
ulimit, umask, env vars, etc in .sh files)

Since the script runs in /sbin/sh this means that *all* init scripts are
*always* run by /sbin/sh, no exceptions.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

 
 
 

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by John Riddoc » Tue, 31 Mar 1998 04:00:00



> How about the user typing in /bin/ksh after logging in as root? It works
> in multi-admin groups because some prefer csh, tsch, or bash. Otherwise,
> maybe set up a menu in the .profile so they can select a shell when they
> log in.

One trick might be to use the USER environment variable, which doesn't
seem to change on su (at least under SunOS 5.5.1 and up).  So, use
/sbin/sh and have the .profile check $USER.

--
John Riddoch                            Programmer/Webmaster
Room C6, School of Computer and Mathematical Science
Robert Gordon University, Aberdeen, AB25 1HG

It IS as bad as you think, and they ARE out to get you.

 
 
 

root's shell, /sbin/sh, /bin/sh and /usr/ksh

Post by how.. » Fri, 03 Apr 1998 04:00:00



> >|Our users want to change the root shell to /bin/ksh.

> Use op instead of su.  It fires up a new $SHELL running as the desired user,
> eg. root.

I'm not familiar with op.
Tried looking in the man pages without much success.
 
 
 

1. #!/bin/sh #!/usr/bin/sh can I do both for 2 diff machines

I'd like the same script to run on 2 different machines, Hp and Sun.
The problem is that sh resides in different directories.  Is there
a way to have exec look in two places?

P.S.  No, I don't have write access to /usr/bin, or /bin

Any help appreciated,

John
--
_________________________________________________________________
Office phone: 503-737-5583 (Batcheller 349);home: 503-757-8772
Office mail:  303 Dearborn Hall, OSU, Corvallis, OR  97331
_________________________________________________________________

2. AS400file conversion

3. /usr/bin, /usr/local/bin, /sbin or /opt/bin, /var/opt/bin - I'm confused.

4. how to use "pthread_rwlock_t" in linux?

5. Any difference between /sbin/sh and /bin/sh?

6. URL managmenet

7. diff /sbin/sh and /bin/sh?

8. Pseudo-terminal access

9. /sbin/sh and /bin/sh

10. /bin/sh .vs. /sbin/sh

11. /bin/sh and /usr/bin/ksh

12. difference between /bin/sh and /sbin/sh

13. /bin/ksh vs /usr/xpg4/bin/sh