It is currently Wed, 12 Dec 2018 21:14:51 GMT



 
Author Message
 chsh on Solaris

Besides 'chsh' you probably also won't find 'chfn'.
Those are BSD utilities that did not make it to the POSIX
standard. In old SunOs they are there, but for some
mysterious reason they were dropped in later versions.
SGI's IRIX 5.3 has the same handicap.
--
Peter



 Sun, 12 Mar 2000 03:00:00 GMT   
 chsh on Solaris

Hi,
        does anyone know why there is no 'chsh' command on Solaris for
changing one's default shell. One has to ask the system administrator to change
the shell.

- Mohit



 Sun, 12 Mar 2000 03:00:00 GMT   
 chsh on Solaris

Hi,

        I have created a small C program on a Sun Solaris box running
SunOS
5.5.1. This program allows users who do not have root privileges to
change their default shells to any shell listed in "/etc/shells". The
compiled executable/binary needs to be owned by root/superuser and the
sticky bit needs to be set on.

        The file "/etc/shells" does not exist by default on SunOS 5.5.1.
You
will need to ask your UNIX administrator to create this. A sample
"/etc/shells" looks like below

/bin/sh

/bin/ksh

/bin/csh

        The C program source code follows

---------------------------------- CUT
----------------------------------------

/******************************************************************************

    This is a wrapper for "/usr/bin/passwd", with the "-e" option so

that users without root privileges can change their default shell, to a

valid shell listed in "/etc/shells".

******************************************************************************/

#include <stdio.h>

#include <sys/types.h>

#include <unistd.h>

#include <pwd.h>

#include <errno.h>

main(int argc, char *argv[])

{

    uid_t this_uid;

    uid_t curr_uid;

    pid_t fork_pid;

    pid_t wait_pid;

    struct passwd *curr_passwd;

    curr_uid = getuid();

    curr_passwd = getpwuid(curr_uid);

    if (curr_passwd == NULL)

    {

        fprintf(stderr, "chsh : %s %d\n", strerror(errno), errno);

        fprintf(stderr, "chsh : Error getpwnam(%d)'.\n", curr_uid);

        exit(1);

    }

    fork_pid = fork();

    if (fork_pid)

    {

        /* IN PARENT */

        while ( (wait_pid = wait((int *) 0)) != -1 &&

                (wait_pid != fork_pid) )

        ;

    }

    else

    {

        /* IN CHILD */

        if (seteuid(0))

        {

            fprintf(stderr, "child : %s %d\n", strerror(errno), errno);

            fprintf(stderr, "child : Error seteuid(0)'.\n");

            exit(1);

        }

        if (setuid(0))

        {

            fprintf(stderr, "child : %s %d\n", strerror(errno), errno);

            fprintf(stderr, "child : Error setuid(0)'.\n");

            exit(1);

        }

        if (execl("/usr/bin/passwd", "passwd", "-e",
curr_passwd->pw_name, (char *)0))

        {

            fprintf(stderr, "chsh : %s %d\n", strerror(errno), errno);

            fprintf(stderr, "chsh : Error execl-ing 'passwd -e'.\n");

            exit(1);

        }

    }

---------------------------------- CUT
---------------------------------------

        Please let me know if you find any problems, security holes in
this

program. My email address is vmac...@edsatt.attmail.com

Thank You

Vinnie Machan



 Tue, 14 Mar 2000 03:00:00 GMT   
 chsh on Solaris

Hi,

there is.
if nis+, nispasswd -s
if nis, RTM passwd, think its "passwd -e" or something..
if files, RTM
Works fine!

--
Per Dahlqvist                           |Tele:070-5950993
Klarinettgatan 24 1tr                   |E-post:pe...@mhd.mh.se
871 61 H?rn?sand                      |Home:www.mhd.mh.se/~perad



 Sun, 19 Mar 2000 03:00:00 GMT   
 
   [ 4 post ] 

Similar Threads

1. chsh for Solaris?

2. chsh on Solaris 2.5?

3. Where is chsh in Solaris 2.x ...?

4. where is chsh for solaris 2.3?

5. chsh on solaris?

6. chsh for Solaris 2.5.1/SunOS 5.5.1

7. passwd, chsh, chpass, chfn, chsh problem

8. User chsh shell change function needed for Solaris

9. need chsh binary for i386-solaris-5.7


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software