LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-14-2013, 02:48 PM   #1
Saeya Darsan
LQ Newbie
 
Registered: Oct 2013
Posts: 4

Rep: Reputation: Disabled
Scripting and ssh login


Quote:
Originally Posted by mrclisdue View Post
Sure it is:
Code:
xterm -e ssh <remote_machine>
Depending on how you've setup ssh, you'll either now be logged into the remote_machine, or you'll have a terminal with a prompt for username/password on the remote.

If you want it scripted

Code:
#!/bin/bash
#open new terminal window with ssh login to machine_name
Terminal -e ssh <remote_machine>
cheers,

Hi,

Is it possible to execute a command in the newly opened terminal with ssh login from the same script?


Thanks in Advance,
Saeya
 
Old 11-11-2013, 05:36 PM   #2
Felipe
Member
 
Registered: Oct 2006
Posts: 302

Rep: Reputation: 32
Not sure what you try, but by default ssh uses the current login user:
[/QUOTE] ssh server "command"[/QUOTE]
or use another user with
Quote:
ssh user@server "command"
If you don't want to be asked for a password, there is different ways:
- Use public/private key.
- Use kerberos (if you are in a kerberos session).
 
Old 11-11-2013, 06:28 PM   #3
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,992

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Code:
[Mon Nov 11 19:24:53 user@user:~ ] $ ssh user@server ls | grep foo
foo
[Mon Nov 11 19:25:00 user@user:~ ] $
that is from the command line, but do keep in mind that local and remote aliases will not function.

Code:
[Mon Nov 11 19:24:38 user@user:~ ] $ ssh user@server d | grep user
bash: d: command not found
[Mon Nov 11 19:24:53 user@user:~ ] $
on all of my systems i have d set to ls -laF as an alias.

read the links in my sig for howto setup ssh keys for passwordless login.
 
  


Reply


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
Remote ssh login (passwords useless), and local login (using password) linuxStudent11 Linux - Security 1 01-09-2013 01:30 PM
Passwordless ssh works. Normal login/ssh Fails. gurunarayanan Linux - Newbie 9 11-08-2012 04:42 AM
[SOLVED] ssh-keygen for auto ssh login not working R00ts Linux - Software 26 09-23-2012 01:40 PM
[SOLVED] SSH login problem for additional users after password-less login setup uncle-c Linux - Newbie 3 02-10-2010 12:51 PM
"Have to automate the SSH login procedure through shell scripting" sorav Programming 2 11-21-2007 04:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:07 AM.

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