Open SSH: Difference between revisions

From WickyWiki
m 1 revision
 
(One intermediate revision by the same user not shown)
Line 29: Line 29:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
nano /dir1/file1
nano /dir1/file1
</syntaxhighlight>
= Run a Command or Shell-Script Even after You Logout =
* https://linux.101hacks.com/unix/nohup-command/
<syntaxhighlight lang=bash>
nohup <command-with-options> &
</syntaxhighlight>
For example, ping for 30 seconds to localhost:
<syntaxhighlight lang=bash>
nohup ping -w 30 localhost &
</syntaxhighlight>
Output is written to the file 'nohup.out':
<syntaxhighlight lang=bash>
cat nohup.out
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 14:39, 23 March 2019

Note: having Ubuntu Server in a virtual machine it is best to access it from a terminal with ssh. This way you will have basic copy and paste functionality with your host.

Install

sudo apt-get install openssh-server openssh-client

Login

When you login with SSH for the first time, it will validate and store a key.

ssh 192.168.1.10 -l someuser

Copy files

SSH copy dir1 from the host (192.168.1.8) to the current directory within the SSH session:

scp -r hostuser@192.168.1.8:/home/ubuntu/dir1 .

Text editor

Nano is a easy to use text editor that you can use in a terminal. Alternatives are vi and ed.

nano /dir1/file1


Run a Command or Shell-Script Even after You Logout

nohup <command-with-options> &

For example, ping for 30 seconds to localhost:

nohup ping -w 30 localhost &

Output is written to the file 'nohup.out':

cat nohup.out