View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 5 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sat Sep 29, 2007 3:11 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
I'd like to have several commands get executed every time a particular user successfully logs in via an ssh or locally. I'm sure there's a dot file I can edit to accomplish this?

Thanks for the info!

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2007 5:54 pm 
Offline
Joined: Tue Dec 20, 2005 9:21 am
Posts: 3
Location: Carrollton, TX
It depends on the shell. For sh, the file would be .profile ;
For bash, it's .bashrc ; for c-shell, it's .cshrc

To find out which shell you're running, use the 'ps' command.
You'll see something like this:

brad@mythtv:~$ ps
PID TTY TIME CMD
4989 ttyp0 00:00:00 sh
4998 ttyp0 00:00:00 ps
brad@mythtv:~$

So, I'm running 'sh', so the file I want is .profile

_________________
Antec Overture revB
MSI K8N NEO4 Platinum
AMD-64 3500+
Dual PcHDTV 3000
ASUS EN6200TC256/TD/64M


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 29, 2007 5:57 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
Killer man, just what I needed. Thanks.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2007 9:46 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
BradBass wrote:
It depends on the shell. For sh, the file would be .profile ; For bash, it's .bashrc

Not quite... sh (aka Bourne Shell) always looks for ~/.profile, however, bash looks for ~/.bash_profile first, and if that's not found it looks for ~/.profile. There is nothing built in that uses ~/.bashrc. That's only a convention established in you .bash_profile or .profile file, either by setting BASH_ENV or explicitly sourcing or dotting in the file. Both shells also fall back on /etc/profile if no local file is found.

Reading the bash man page and/or info pages will provide more details:
Code:
man bash
info bash


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 8:55 am 
Offline
Joined: Tue Dec 20, 2005 9:21 am
Posts: 3
Location: Carrollton, TX
tjc wrote:
There is nothing built in that uses ~/.bashrc. That's only a convention established in your .bash_profile or .profile file.

My mistake -- looking back, I don't remember
whether I was on my Knoppmyth box, Kubuntu
box or some other Unix system. Different
distributions sometimes use different
conventions, but tjc is correct -- there is a "one
true way" that they all follow. Nice catch!

Brad

_________________
Antec Overture revB
MSI K8N NEO4 Platinum
AMD-64 3500+
Dual PcHDTV 3000
ASUS EN6200TC256/TD/64M


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 77 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu