- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Running commands automatically via SSH
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2004 06:28 PM
02-12-2004 06:28 PM
Running commands automatically via SSH
I'm trying to figure how to do something that I think is possible.
I have many users on a server that I would like to give access to one
particular script. However most of them don't know how to use SSH or Linux and I would rather not have to teach them all.
So, what I want to do is setup some kind of SSH client for them that they can simply run. But instead of logging into the Linux box and giving them a command prompt, it just logs in, runs the command, and exits. All while being fairly transparent to the user. Of course the user would at some point have to enter a username and password.
Also, if possible, it would be nice to be able to integrate this into a web page. I was looking at MindTerm for that, the Java applet.
Does anyone know of any way to do this? Or of any SSH clients (preferably free) that have these kind of configuration options?
Also, I don't have access to these users individual machines. So it would be best to have something that I could configure and then hand over to them. Which is another reason a web based client would be nice.
Any help is very much appreciated.
Thanks,
Travis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2004 06:55 PM
02-12-2004 06:55 PM
Re: Running commands automatically via SSH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2004 08:27 PM
02-12-2004 08:27 PM
Re: Running commands automatically via SSH
man ssh helps.
hth,
Claudio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 12:23 AM
02-13-2004 12:23 AM
Re: Running commands automatically via SSH
scriptname
logout
After the script runs, it will log them out..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 01:39 AM
02-13-2004 01:39 AM
Re: Running commands automatically via SSH
user:x:1000:1000:Joe User:/home/user:/usr/local/myscript
when the user logs in, your script gets executed as their login shell, when the "shell" terminates, their session terminates. This of course is independent of ssh, telnet, rlogin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 01:53 AM
02-13-2004 01:53 AM
Re: Running commands automatically via SSH
There are available for the windows desktop a few ssh tools that work in "DOS" mode and could let you integrate with the Windows Scheduler to do things on an automated basis.
The last time I found a tool like this it was on download.com or tucows.com
This may be more what you are looking for.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 03:37 AM
02-13-2004 03:37 AM
Re: Running commands automatically via SSH
What I personnally prefer is to set menu for this kind of users. instead of /bin/bash as their shell in /etc/passwd I put something like /script/menu.sh
menu.sh looks like this
########
!/bin/sh
trap "" 0 1 2 3 15
if [ $SERVER = APP ]
then
/script/appMenu.sh
else
echo "*** Cannot start menu for this server type : $SERVER ***"
fi
exit 0
#######
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 04:00 AM
02-13-2004 04:00 AM
Re: Running commands automatically via SSH
depending on what the script does and how much user interaction it does require it really might be easiest to wrap it into a CGI and execute it via a Webserver. Since you do seem to be concerned about security use a secured port (https usually port 443) for the connection.
Greetings, Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 10:31 AM
02-13-2004 10:31 AM
Re: Running commands automatically via SSH
Now, if I write a bash script to login automatically via ftp, how would I pass data to it? I need to give it the IP, username, and password. I have never used a shell script as a cgi on a web page so I'm not sure exactly how I would do this.
Also, there are actually multiple machines that users would access this script on (but each user only needs access to one machine, not multiple ones).
So I don't really want to run a web server on each machine just to host this one cgi program.
Any other advise?
Thanks again,
Travis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 12:46 PM
02-13-2004 12:46 PM
Re: Running commands automatically via SSH
up to now the advise has been pretty generic, on the other hand while you obviously have thought about this for a while the questions you have asked have been generic too (maybe even because you have thought about it hard, so it is all obvious to you ;-)
Please give us some more background information. I do assume you endusers are located at (Windows) PCs. Is this correct?
You want them to execute 'a script' running on a few Linux servers. What is this script supposed to do? In you last message you mention ftp. If all you want to do is transfer files from/to the PCs of your endusers there might be easier ways to do this, but we really need some more information to figure this out with you.
Greetings, Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2004 09:56 AM
02-14-2004 09:56 AM
Re: Running commands automatically via SSH
In my last post I said FTP but meant SSH. I don't need to do anything at all with FTP.
OK, let me try to explain what I wan to do.
We have multiple servers that we host online games on for customers.
The script that I speak of is used for restarting the individual game. All it does is simply kill the process of the game owned by the user running the script. The game is then restarted automatically from a cron job.
What I want to do is have a central web page that the customers could go to to restart their own game. Just a page that asks for the IP address of their game, their username, and their password.
This info could then be passed to a cgi program of some kind which would in turn log that user in via ssh to their particular server, determined from the IP they entered.
I guess then I would just run the script from that users .profile file and then log them out.
Yes, most of the users are on Windows machines. Maybe a few Macs too, but don't worry about that for now.
So, what would be the best way to pass this info into a cgi?
I hope this made my situation a bit clearer.
Thank you all very much.
Travis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2004 04:58 AM
02-15-2004 04:58 AM
Re: Running commands automatically via SSH
I think the idea with the central Webpage is a good one. Authentication can be done in the Webserver and the username can be retrieved by the script from the environment. You will obviously need a simple "database" to make sure users only stop their own games. You could use the NET::SSH perl module to connect from the webserver to the other linux systems. You can pass a command/scriptname to SSH directly, so you do not even have to fiddle with the .profiles.
Obvously all of this could be implemented in a number of languages other than Perl (php, Python and Java come immediatly to mind) so take the one you are most comfortable with.
Greetings, Martin