motd and path - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

motd and path

minionminion Posts: 36Member
I have 2 questions. My first is...

I want certain users to have a certain path when they log in. How can I change a users path as soon as they log in? For exaple, I want to add /root/bin to roots path right when root logs in. How could I do this?

Also...
Im running slackware 8.0 . /etc/motd for some reason sets itself back to its original form when rebooted. Any way I can fix that?

Comments

  • NishRevertNishRevert Posts: 64Member
    use their home directory profiles. Or if you really want to be cheap you can set it up in the /etc/profile using a case statement. An example of that would be:
    ------------------------------------------------
    user = `/bin/id | nawk -F '[()]' '{printf $2}'`
    case $user
    in
    root) PATH=$PATH:/root/bin; export PATH ;;
    lp) PATH=$PATH:/lp/bin; export PATH ;;
    *) : ;;
    esac
    ------------------------------------------------

    $user is now the username, and the case statement is running through checking the username, then setting the path.

    Let me know if you have any questions.


    [email protected]



    : I have 2 questions. My first is...
    :
    : I want certain users to have a certain path when they log in. How can I change a users path as soon as they log in? For exaple, I want to add /root/bin to roots path right when root logs in. How could I do this?
    :
    : Also...
    : Im running slackware 8.0 . /etc/motd for some reason sets itself back to its original form when rebooted. Any way I can fix that?
    :


  • minionminion Posts: 36Member
    Ok, im trying to case statement. I understand how it sets roots path, but whats the lp for? Can i just add any user in there and their path if I want to set it?

    : use their home directory profiles. Or if you really want to be cheap you can set it up in the /etc/profile using a case statement. An example of that would be:
    : ------------------------------------------------
    : user = `/bin/id | nawk -F '[()]' '{printf $2}'`
    : case $user
    : in
    : root) PATH=$PATH:/root/bin; export PATH ;;
    : lp) PATH=$PATH:/lp/bin; export PATH ;;
    : *) : ;;
    : esac
    : ------------------------------------------------
    :
    : $user is now the username, and the case statement is running through checking the username, then setting the path.
    :
    : Let me know if you have any questions.
    :
    :
    : [email protected]
    :
    :
    :
    : : I have 2 questions. My first is...
    : :
    : : I want certain users to have a certain path when they log in. How can I change a users path as soon as they log in? For exaple, I want to add /root/bin to roots path right when root logs in. How could I do this?
    : :
    : : Also...
    : : Im running slackware 8.0 . /etc/motd for some reason sets itself back to its original form when rebooted. Any way I can fix that?
    : :
    :
    :


  • NishRevertNishRevert Posts: 64Member
    lp is just another user example, such as root or adm. If you have other users you want to sets path automatically you can do this. The * is for everything else. The : after the astrisk is just a space filler. It is needed to say not to do anything. You can also have the a | for anything else you want to use the same function. Like if you want the user tmpuser to use the same path as root. You would enter the case line below like:
    root|tmpuser) PATH=$PATH:/root/bin; export PATH ;;

    Just to help you out.

    [email protected]



    : Ok, im trying to case statement. I understand how it sets roots path, but whats the lp for? Can i just add any user in there and their path if I want to set it?
    :
    : : use their home directory profiles. Or if you really want to be cheap you can set it up in the /etc/profile using a case statement. An example of that would be:
    : : ------------------------------------------------
    : : user = `/bin/id | nawk -F '[()]' '{printf $2}'`
    : : case $user
    : : in
    : : root) PATH=$PATH:/root/bin; export PATH ;;
    : : lp) PATH=$PATH:/lp/bin; export PATH ;;
    : : *) : ;;
    : : esac
    : : ------------------------------------------------
    : :
    : : $user is now the username, and the case statement is running through checking the username, then setting the path.
    : :
    : : Let me know if you have any questions.
    : :
    : :
    : : [email protected]
    : :
    : :
    : :
    : : : I have 2 questions. My first is...
    : : :
    : : : I want certain users to have a certain path when they log in. How can I change a users path as soon as they log in? For exaple, I want to add /root/bin to roots path right when root logs in. How could I do this?
    : : :
    : : : Also...
    : : : Im running slackware 8.0 . /etc/motd for some reason sets itself back to its original form when rebooted. Any way I can fix that?
    : : :
    : :
    : :
    :
    :


Sign In or Register to comment.