LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-27-2010, 03:41 AM   #1
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Rep: Reputation: 51
How to run nohup with password?


I have a ssh command as shown:
Code:
ssh remoteusr@<ip> "perl ./monitor.pl count_pages" | /monty/graphs/mail.pl
This command connects to remote machine and fetches data which gets continously streamed at screen(shown at terminal).
If I do Ctrl+Z and bg to put it into background.
Works Fine.
But when i close the putty, it gets closed surprisingly.

I tried with nohup <command> &
But wonder how to provide password.
Any Suggestion?
 
Old 01-27-2010, 03:43 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
don't. use a preshared key instead.
 
Old 01-27-2010, 03:58 AM   #3
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Can you elaborate?
do you mean SSH with DSA ?
Why do we need that way?
Can't it be done in simple ssh way?
 
Old 01-27-2010, 04:08 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
yes i do. it is VERY simple. simpler than trying to hack in a password.
 
1 members found this post helpful.
Old 01-27-2010, 09:33 AM   #5
eyemole80
Member
 
Registered: Jun 2004
Distribution: Fedora Core 1
Posts: 47
Blog Entries: 1

Rep: Reputation: 16
Use "screen" sessions for such type of tasks.
Even if you logout the command keeps on running.

# screen -S copying-data
# run commands here
#
ctrl-A ctrl-D

see man page of screen how to connect and dis-connect after a screen session is started.
 
Old 01-27-2010, 11:14 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Only if you have an interest in reconnecting to it. To use screen habitually can drain resources and all that.
 
Old 01-28-2010, 12:25 AM   #7
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,461
Blog Entries: 6

Original Poster
Rep: Reputation: 51
Screen has always been my passionate command when I am working with my Colleagues.
Thats Very good Tool
 
Old 01-28-2010, 03:38 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
a passionate command?? sounds dubious.
 
Old 04-15-2012, 05:15 AM   #9
pti4ka
LQ Newbie
 
Registered: Apr 2012
Posts: 1

Rep: Reputation: Disabled
It could be done using pipe:

Code:
mkfifo pipe
nohup [your local process] <pipe &
ssh [other ssh options] -f [your remote process] >pipe

Last edited by pti4ka; 04-15-2012 at 06:01 AM.
 
1 members found this post helpful.
Old 04-15-2012, 06:45 AM   #10
xuta
LQ Newbie
 
Registered: Apr 2011
Location: Hanoi, Vietnam
Distribution: Ubuntu, OpenSuSE, Debian, Gentoo
Posts: 24

Rep: Reputation: 0
Quote:
Originally Posted by pti4ka View Post
It could be done using pipe:

Code:
mkfifo pipe
nohup [your local process] <pipe &
ssh [other ssh options] -f [your remote process] >pipe
Woa, so cool.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run a script without password ! shipon_97 AIX 1 12-29-2009 07:53 AM
run script on invalid password slimm609 Linux - Security 1 12-14-2008 02:27 PM
login and password when run pclinuxos from live cd ovidiul Linux - Newbie 10 09-02-2007 03:17 PM
problem with nohup command and nohup file size vbseeker Linux - General 1 09-17-2006 12:36 PM
My Knoppix 3.7 need root password when I run program AskMe Linux - Software 5 04-15-2005 06:35 AM


All times are GMT -5. The time now is 01:17 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration