IRIX adduser command? - SGI

This is a discussion on IRIX adduser command? - SGI ; Hi, What is the easiest way to add a user in a SSH session? I many other unix OSes there is the 'adduser' command, but so far I've only added users through the graphical interface. I've been looking around the ...

+ Reply to Thread
Results 1 to 16 of 16

Thread: IRIX adduser command?

  1. IRIX adduser command?

    Hi,

    What is the easiest way to add a user in a SSH
    session? I many other unix OSes there is the
    'adduser' command, but so far I've only added
    users through the graphical interface.

    I've been looking around the Internet but haven't
    found any solution. I thought there was something
    in the FAQ but can't find it.

    It might be possible to edit the passwd file, but
    that's not a very good solution I think.

    I'm talking about IRIX6.5

    /Bjorn


  2. Re: IRIX adduser command?

    In article ,
    Bjorn Ljungdahl wrote:
    :What is the easiest way to add a user in a SSH
    :session?

    Edit the passwd file.

    :I many other unix OSes there is the
    :'adduser' command, but so far I've only added
    :users through the graphical interface.

    :It might be possible to edit the passwd file, but
    :that's not a very good solution I think.

    Well, if you insist, you could load sysadmdesktop.sw.sysadm
    and use the utility routine addUserAccount
    --
    Disobey all self-referential sentences!

  3. Re: IRIX adduser command?

    Walter Roberson wrote:
    > In article ,
    > Bjorn Ljungdahl wrote:
    > :What is the easiest way to add a user in a SSH
    > :session?
    >
    > Edit the passwd file.


    ugh, walter... that is just sooo lo-tech.



    avi


  4. Re: IRIX adduser command?

    In article <3fbeace4$0$1502$e4fe514c@news.xs4all.nl>,
    Avi Bercovich wrote:
    |Walter Roberson wrote:
    |> In article ,
    |> Bjorn Ljungdahl wrote:
    |> :What is the easiest way to add a user in a SSH
    |> :session?

    |> Edit the passwd file.

    |ugh, walter... that is just sooo lo-tech.

    The procedure around here involves shaped magnetic fields, controlled
    chaos, and holographic memory in Q-bits -- but editing the passwd
    file is *easier*.
    --
    Studies show that the average reader ignores 106% of all statistics
    they see in .signatures.

  5. Re: IRIX adduser command?

    Walter Roberson wrote:
    > In article ,
    > Bjorn Ljungdahl wrote:
    >:What is the easiest way to add a user in a SSH
    >:session?
    >
    > Edit the passwd file.
    >
    >:I many other unix OSes there is the
    >:'adduser' command, but so far I've only added
    >:users through the graphical interface.
    >
    >:It might be possible to edit the passwd file, but
    >:that's not a very good solution I think.
    >
    > Well, if you insist, you could load sysadmdesktop.sw.sysadm
    > and use the utility routine addUserAccount


    Or use passmgmt which is available by default.

    Ivan
    --
    Ivan Rayner
    ivanr@sgi.com

  6. Re: IRIX adduser command?

    Bash script!
    #!/bin/bash
    echo "Please, enter the user name"
    read NAME
    echo "Please enter the users full name"
    read FULLNAME
    echo "Where will $NAME live?"
    df -h /users/* | sort -n
    read HOME
    last_uid=`cat /etc/passwd | tail -n1 | cut -d: -f3`
    next_uid=$(($last_uid+1))
    echo $NAME:x:$next_uid:100:$FULLNAME:/users/$HOME/$NAME:/bin/bash >>
    /etc/passwd
    mkdir /users/$HOME/$NAME
    cp /etc/skel/.* /users/$HOME/$NAME
    chown -R $NAME /users/$HOME/$NAME
    chgrp -R users /users/$HOME/$NAME
    echo $NAME:::0:99999:7::: >> /etc/shadow
    passwd $NAME


    Well hay it works.........


    *********************
    Khalid Schofield
    System Administrator / EM Technician
    Dept. Of Materials
    University Of Oxford
    Parks Road
    Oxford
    OX1 3PH

    Email: khalid.schofield@materials.ox.ac.uk
    Tel: 01865 273785
    Fax: 01865 283333
    Web: http://www-em.materials.ox.ac.uk/peo...eld/index.html


    On Fri, 21 Nov 2003, Bjorn Ljungdahl wrote:

    > Hi,
    >
    > What is the easiest way to add a user in a SSH
    > session? I many other unix OSes there is the
    > 'adduser' command, but so far I've only added
    > users through the graphical interface.
    >
    > I've been looking around the Internet but haven't
    > found any solution. I thought there was something
    > in the FAQ but can't find it.
    >
    > It might be possible to edit the passwd file, but
    > that's not a very good solution I think.
    >
    > I'm talking about IRIX6.5
    >
    > /Bjorn
    >
    >


  7. Re: IRIX adduser command?

    Bjorn Ljungdahl wrote in message news:...
    > Hi,
    >
    > What is the easiest way to add a user in a SSH
    > session? I many other unix OSes there is the
    > 'adduser' command, but so far I've only added
    > users through the graphical interface.
    >
    > I've been looking around the Internet but haven't
    > found any solution. I thought there was something
    > in the FAQ but can't find it.
    >
    > It might be possible to edit the passwd file, but
    > that's not a very good solution I think.
    >
    > I'm talking about IRIX6.5
    >
    > /Bjorn


    Most everything done through the toolchest ends up calling commands in
    /usr/sysadm/privbin. I know there's one in there for adding a user,
    but I can't remember the command name right now.

    It'll take options for uid, gid, home directory, shell and the like.

  8. re: IRIX adduser command? addUserAccount

    /usr/sysadm/privbin/addUserAccount

    have a look at the man page.

    In Bjorn Ljungdahl wrote:
    > Hi,
    >
    > What is the easiest way to add a user in a SSH
    > session? I many other unix OSes there is the
    > 'adduser' command, but so far I've only added
    > users through the graphical interface.
    >
    > I've been looking around the Internet but haven't
    > found any solution. I thought there was something
    > in the FAQ but can't find it.
    >
    > It might be possible to edit the passwd file, but
    > that's not a very good solution I think.
    >
    > I'm talking about IRIX6.5
    >
    > /Bjorn
    >
    >


  9. Re: IRIX adduser command?


    Thank you for your replies.

    addUserAccount is just what I've been looking for,
    and thank you for the script, Khalid.

    /Bjorn


  10. Re: IRIX adduser command?

    yeh the script is a botch but hay it works :-) Need to get it adding users
    to my /etc/postfix/aliases file as well as giving them a soft quota of 1Gb
    and a 2Gb hard quota.

    Any ideas of how to do this with gnu quota system?

    *********************
    Khalid Schofield
    System Administrator / EM Technician
    Dept. Of Materials
    University Of Oxford
    Parks Road
    Oxford
    OX1 3PH

    Email: khalid.schofield@materials.ox.ac.uk
    Tel: 01865 273785
    Fax: 01865 283333
    Web: http://www-em.materials.ox.ac.uk/peo...eld/index.html


    On Sun, 23 Nov 2003, Bjorn Ljungdahl wrote:

    >
    > Thank you for your replies.
    >
    > addUserAccount is just what I've been looking for,
    > and thank you for the script, Khalid.
    >
    > /Bjorn
    >
    >


  11. Re: IRIX adduser command?

    Khalid Schofield wrote:
    : yeh the script is a botch but hay it works :-) Need to get it adding users

    you may want to add passwd locking while you are appending
    entries to /etc/passwd and /etc/shadow

    cat > lckpwdf.c < #include
    #include
    #include

    int main(int argc, char **argv, char **envp)
    {
    if(-1!=lckpwdf())
    {
    execvp( argv[1], &argv[1]);
    ulckpwdf();
    return (1);
    }
    else
    {
    fprintf(stderr,"Try again later\n");
    return (0);
    }
    }
    EOF
    cc -o lckpwdf lckpwdf.c

    use: ./lckpwdf my_script.sh


    : to my /etc/postfix/aliases file as well as giving them a soft quota of 1Gb
    : and a 2Gb hard quota.

    : Any ideas of how to do this with gnu quota system?

    why do you want to use gnu quota system in IRIX?

    With IRIX quotas you can try:

    - /usr/local/sbin/edq -----------------------------------------------------
    #!/bin/sh

    IFS=
    PATH=/bin:/usr/etc

    set -e

    if [ $# -ne 4 ]
    then
    echo Usage: `basename $0` filesystem soft hard user
    exit 1
    else
    EDITOR="/usr/local/sbin/.edq"
    export EDITOR

    FILESYS=$1
    SOFT=$2
    HARD=$3

    export FILESYS SOFT HARD

    edquota $4

    exit 0
    fi
    ---------------------------------------------------------------------------
    - /usr/local/sbin/.edq ----------------------------------------------------
    #!/bin/sh



    EFILESYS=`echo $FILESYS |sed -e 's/\//\\\\\//g'`

    ed $1 << ++
    H
    /$EFILESYS
    d
    a
    fs $FILESYS kbytes (soft = $SOFT, hard = $HARD) inodes (soft = 0, hard = 0)
    ..
    w
    q
    ++

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

    --
    finger spd@shiva.cps.unizar.es for PGP /
    ..mailcap tip of the day: / La vida es una carcel
    application/ms-tnef; cat '%s' > /dev/null / con las puertas abiertas
    text/x-vcard; cat '%s' > /dev/null / (A. Calamaro)

  12. Re: IRIX adduser command?

    I'm using the GNU quota system bacause
    *cough*
    I'm running linux on my server (yeh sorry I know it's messy but it's a
    PeeCee survur)



    *********************
    Khalid Schofield
    System Administrator / EM Technician
    Dept. Of Materials
    University Of Oxford
    Parks Road
    Oxford
    OX1 3PH

    Email: khalid.schofield@materials.ox.ac.uk
    Tel: 01865 273785
    Fax: 01865 283333
    Web: http://www-em.materials.ox.ac.uk/peo...eld/index.html


    On Thu, 27 Nov 2003, J.A. Gutierrez wrote:

    > Khalid Schofield wrote:
    > : yeh the script is a botch but hay it works :-) Need to get it adding users
    >
    > you may want to add passwd locking while you are appending
    > entries to /etc/passwd and /etc/shadow
    >
    > cat > lckpwdf.c < > #include
    > #include
    > #include
    >
    > int main(int argc, char **argv, char **envp)
    > {
    > if(-1!=lckpwdf())
    > {
    > execvp( argv[1], &argv[1]);
    > ulckpwdf();
    > return (1);
    > }
    > else
    > {
    > fprintf(stderr,"Try again later\n");
    > return (0);
    > }
    > }
    > EOF
    > cc -o lckpwdf lckpwdf.c
    >
    > use: ./lckpwdf my_script.sh
    >
    >
    > : to my /etc/postfix/aliases file as well as giving them a soft quota of 1Gb
    > : and a 2Gb hard quota.
    >
    > : Any ideas of how to do this with gnu quota system?
    >
    > why do you want to use gnu quota system in IRIX?
    >
    > With IRIX quotas you can try:
    >
    > - /usr/local/sbin/edq -----------------------------------------------------
    > #!/bin/sh
    >
    > IFS=
    > PATH=/bin:/usr/etc
    >
    > set -e
    >
    > if [ $# -ne 4 ]
    > then
    > echo Usage: `basename $0` filesystem soft hard user
    > exit 1
    > else
    > EDITOR="/usr/local/sbin/.edq"
    > export EDITOR
    >
    > FILESYS=$1
    > SOFT=$2
    > HARD=$3
    >
    > export FILESYS SOFT HARD
    >
    > edquota $4
    >
    > exit 0
    > fi
    > ---------------------------------------------------------------------------
    > - /usr/local/sbin/.edq ----------------------------------------------------
    > #!/bin/sh
    >
    >
    >
    > EFILESYS=`echo $FILESYS |sed -e 's/\//\\\\\//g'`
    >
    > ed $1 << ++
    > H
    > /$EFILESYS
    > d
    > a
    > fs $FILESYS kbytes (soft = $SOFT, hard = $HARD) inodes (soft = 0, hard = 0)
    > .
    > w
    > q
    > ++
    >
    > ---------------------------------------------------------------------------
    >
    > --
    > finger spd@shiva.cps.unizar.es for PGP /
    > .mailcap tip of the day: / La vida es una carcel
    > application/ms-tnef; cat '%s' > /dev/null / con las puertas abiertas
    > text/x-vcard; cat '%s' > /dev/null / (A. Calamaro)
    >


  13. Re: IRIX adduser command?

    Khalid Schofield wrote:
    : I'm using the GNU quota system bacause
    : *cough*
    : I'm running linux on my server (yeh sorry I know it's messy but it's a
    : PeeCee survur)

    ok, then you can do this:

    dev=`df \`dirname $home\` | tail -1 | awk -F' ' '{print $1}'`
    setquota $uname $QSOFT $QHARD 0 0 $dev


    --
    finger spd@shiva.cps.unizar.es for PGP /
    ..mailcap tip of the day: / La vida es una carcel
    application/ms-tnef; cat '%s' > /dev/null / con las puertas abiertas
    text/x-vcard; cat '%s' > /dev/null / (A. Calamaro)

  14. Re: IRIX adduser command?

    Exerlent!!!

    I didn't know there was a set quota command. I've automated user account
    registration now ;-)

    Only one last thing to do. I've a file listing email addresses in comma
    separated format

    (/etc/postfix/aliases)

    users: users@domain, user1@domain1, user$@domain,

    How can I add a value $email_address to the file at the end of the line?

    doing echo $email_address >> /etc/postfix/aliases adds them to a new line.
    I need to append a current line.

    Is this a job for gnu sed?


    thanks for info on setquota :-)

    *********************
    Khalid Schofield
    System Administrator / EM Technician
    Dept. Of Materials
    University Of Oxford
    Parks Road
    Oxford
    OX1 3PH

    Email: khalid.schofield@materials.ox.ac.uk
    Tel: 01865 273785
    Fax: 01865 283333
    Web: http://www-em.materials.ox.ac.uk/peo...eld/index.html


    On Thu, 4 Dec 2003, J.A. Gutierrez wrote:

    > Khalid Schofield wrote:
    > : I'm using the GNU quota system bacause
    > : *cough*
    > : I'm running linux on my server (yeh sorry I know it's messy but it's a
    > : PeeCee survur)
    >
    > ok, then you can do this:
    >
    > dev=`df \`dirname $home\` | tail -1 | awk -F' ' '{print $1}'`
    > setquota $uname $QSOFT $QHARD 0 0 $dev
    >
    >
    > --
    > finger spd@shiva.cps.unizar.es for PGP /
    > .mailcap tip of the day: / La vida es una carcel
    > application/ms-tnef; cat '%s' > /dev/null / con las puertas abiertas
    > text/x-vcard; cat '%s' > /dev/null / (A. Calamaro)
    >


  15. Re: IRIX adduser command?

    On 2003-12-04, Khalid Schofield wrote:
    > Only one last thing to do. I've a file listing email addresses in comma
    > separated format
    >
    > (/etc/postfix/aliases)
    >
    > users: users@domain, user1@domain1, user$@domain,
    >
    > How can I add a value $email_address to the file at the end of the line?
    >
    > doing echo $email_address >> /etc/postfix/aliases adds them to a new line.
    > I need to append a current line.
    >
    > Is this a job for gnu sed?


    This kind of question would be better answered on comp.unix.shell.

    Anyway:

    #!/bin/sh
    # addmailuser

    sed -e "/^users:{
    s/\$/, $1/
    q
    }" /etc/postfix/aliases > /etc/postfix/aliases.new
    mv /etc/postfix/aliases.new /etc/postfix/aliases

    then:

    addmailuser 'user@domain'

    If postfix accepts a non-terminated last line:

    #!/bin/sh
    echo ", $1\c" >> /etc/postfix/aliases

    Calling this script concurrently will likely corrupt your aliases file.
    You'd have to use some kind of locking to ensure proper operations.

    --
    wave++ (also known, in some places, as "Yuri D'Elia") http://www.yuv.info/
    The email address is fake (thanks swen)! You know how to contact me anyway.

  16. Re: IRIX adduser command?

    Thanks
    I've posted this in comp.unix.shell before (erm I think or maybe it was
    another related question....can't remember). Yeh should have posted it
    there anyway since we were talking about scripting in the other thread I
    though well why not :-).



    *********************
    Khalid Schofield
    System Administrator / EM Technician
    Dept. Of Materials
    University Of Oxford
    Parks Road
    Oxford
    OX1 3PH

    Email: khalid.schofield@materials.ox.ac.uk
    Tel: 01865 273785
    Fax: 01865 283333
    Web: http://www-em.materials.ox.ac.uk/peo...eld/index.html


    On Thu, 4 Dec 2003, wave++ wrote:

    > On 2003-12-04, Khalid Schofield wrote:
    > > Only one last thing to do. I've a file listing email addresses in comma
    > > separated format
    > >
    > > (/etc/postfix/aliases)
    > >
    > > users: users@domain, user1@domain1, user$@domain,
    > >
    > > How can I add a value $email_address to the file at the end of the line?
    > >
    > > doing echo $email_address >> /etc/postfix/aliases adds them to a new line.
    > > I need to append a current line.
    > >
    > > Is this a job for gnu sed?

    >
    > This kind of question would be better answered on comp.unix.shell.
    >
    > Anyway:
    >
    > #!/bin/sh
    > # addmailuser
    >
    > sed -e "/^users:{
    > s/\$/, $1/
    > q
    > }" /etc/postfix/aliases > /etc/postfix/aliases.new
    > mv /etc/postfix/aliases.new /etc/postfix/aliases
    >
    > then:
    >
    > addmailuser 'user@domain'
    >
    > If postfix accepts a non-terminated last line:
    >
    > #!/bin/sh
    > echo ", $1\c" >> /etc/postfix/aliases
    >
    > Calling this script concurrently will likely corrupt your aliases file.
    > You'd have to use some kind of locking to ensure proper operations.
    >
    > --
    > wave++ (also known, in some places, as "Yuri D'Elia") http://www.yuv.info/
    > The email address is fake (thanks swen)! You know how to contact me anyway.
    >


+ Reply to Thread