Linux Support

Moderators: None (Apply to moderate this forum)
Number of threads: 332
Number of posts: 953

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
motd and path Posted by minion on 12 Oct 2001 at 2:46 PM
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?

Report
Re: motd and path Posted by NishRevert on 14 Oct 2001 at 12:52 AM
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.


nishrevert@yahoo.com



: 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?
:


Report
Re: motd and path Posted by minion on 16 Oct 2001 at 5:57 PM
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.
:
:
: nishrevert@yahoo.com
:
:
:
: : 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?
: :
:
:


Report
Re: motd and path Posted by NishRevert on 17 Oct 2001 at 1:25 AM
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.

nishrevert@yahoo.com



: 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.
: :
: :
: : nishrevert@yahoo.com
: :
: :
: :
: : : 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?
: : :
: :
: :
:
:





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.