Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 10-25-2008, 07:30 PM   #1
LQ Newbie
Registered: Oct 2008
Posts: 1

Rep: Reputation: 0
Running a program on SSH login

Hi folks, this is my first post here on, i hope you can help me on this one.

i have sshd on my pc and i want to be able to connect via ssh anywhere, so far everything good. but i also want that when i logon on SSH that a program that i made run automatically.

thanks in advace.
Old 10-26-2008, 12:01 PM   #2
Registered: Aug 2005
Distribution: SuSE Linux / Scientific Linux / [K|X]ubuntu
Posts: 273

Rep: Reputation: 32
You could add the script to your (bash) profile, probably in your /etc directory. Another way is to use an expect script. There are other ways, but these two are probably the easiest.

Two tips: 1) search LQ for similar questions, as this has been asked before. 2) google your question, because this is fairly basic stuff for ssh.
Old 10-26-2008, 12:05 PM   #3
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS6
Posts: 267

Rep: Reputation: 58
From man ssh:

Commands in this file are executed by ssh when the user logs in, just
before the user’s shell (or command) is started. See the sshd(8) manual
page for more information.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh-ing into an already running program everyday Linux - Software 4 07-23-2008 04:08 AM
HELP!! running program to ssh bad_jaye Linux - Newbie 4 02-25-2008 07:23 PM
C program for automatic ssh login trollkotze Linux - General 5 01-09-2008 08:53 PM
Running Program Through SSH windisch Linux - General 6 10-04-2005 06:10 AM
Running a program in the background - SSH ziggo0 Linux - Newbie 4 03-05-2005 01:30 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration