ssh and github check ssh and socks4/5
or if you have multiple ssh with different passwords but you generate rsa keys for all of them, so you can connect to all with only one pass phrase.
$ ssh-keygen -t rsa -C "firstname.lastname@example.org" # generate your ssh keys
$ eval "$(ssh-agent)"
$ ssh-copy-id -i ~/.ssh/id_rsa_passless.pub email@example.com
$ sudo /sbin/service sshd restart # you might have to restart sshd
# if ssh to localhost doesn't work,
$ alias dev='ssh firstname.lastname@example.org -p 22000'
$ # To connect:
ssh-copy-id for moving your public keys. It will save you quite a few folder/file permission headaches.
# contents of $HOME/.ssh/config
This means that I can simply
Port forwarding: Say you want to block your ports and still want to connect to a remote server on some port, but you want to close outside connections.
put ssh password in commandline:
sshpass -p 'trecGuest' ssh trecGuest@sm321-01.cise.ufl.edu "cat /media/sde/s3.amaz.gpg" | gpg --output - --decrypt - | xz --decompress
sshpass -p "PASSWORD" scp -rp /home/morteza/zproject/gatordsr/code/src/main/java/ email@example.com:/home/morteza/zproject/gatordsr/code/src/main/; sshpass -p "PASSWORD" scp -rp /home/morteza/zproject/gatordsr/code/src/main/scala/ firstname.lastname@example.org:/home/morteza/zproject/gatordsr/code/src/main/
ssh -Y user@machine #ssh and run graphical programs on the server even if it doesn't have X!!!!!!!!
ssh -X ,, ,,, ,, ,, ,, ,, ,,
ssh -t xxx.xxx.xxx.xxx "cd /directory_wanted ; bash" # -t will let to execute arbitrary commands on remote machine
$ scp *.txt email@example.com:/home/s3guest/
Transfer files to SSH
$ sudo rsync -avPp firstname.lastname@example.org:/opt/* .
It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use.
Rsync finds files that need to be transferred using a “quick check” algorithm (by default) that looks for files that have changed in size or in last-modified time. Any changes in the other preserved attributes (as requested by options)
are made on the destination file directly when the quick check indicates that the file’s data does not need to be updated.
-- Execute on local machine
cp ~/downloads/skey.pem ~/.ssh/
$ chmod 400 ~/.ssh/skey.pem
$ chmod 700 ~/.ssh
$ nano ~/.ssh/config
# edit the file as shown below
$ cat ~/.ssh/config
$ ssh awshost1
$ scp hello.txt awshost1:~/ ======== scp -i skey.pem hello.txt email@example.com:~/
scp -i ~/.ssh/id_rsa -P 2022 Downloads/elementary_journal.pdf firstname.lastname@example.org:~/c.pdf
$ scp awshost1:~/foo.txt .
Sharing Terminal Sessions With Tmux And Screen ---- Avoid: Dropped connection and stopping processes.
| || |
For different users, you have to set the permissions on the tmux socket so that both users can read and write it. There is only one prerequiste, that there be a group in common between the two users. If such a group does not exist it will be necessary to create one.
In the first terminal
$ tmux -S /tmp/shareds new -s shared start tmux where shared is the session name and shareds is the name of the socket:
$ chgrp joint /tmp/shareds
Then chgrp the socket to a group that both users share in common. In this example, joint is the group that both users share. If there are other users in the group, then they also have access. So it might be recommended that the group have only the two members.
In the second terminal
$ tmux -S /tmp/shareds attach -t shared attach using that socket and session.
That's it. The session can be made read-only for the second user, but only on a voluntary basis. The decision to work read-only is made when the second user attaches to the session.
tmux -S /tmp/shareds attach -t shared -r
The formatting here is simple enough to understand (I would hope). ^ means ctrl+, so ^x is ctrl+x. M- means meta (generally left-alt or escape)+, so M-x is left-alt+x
|start a new session||tmux OR |
tmux new OR
|re-attach a detached session||tmux attach OR |
|re-attach an attached session (detaching it from elsewhere)||tmux attach -d OR |
tmux attach-session -d
|re-attach an attached session (keeping it attached elsewhere)||tmux attach OR |
|detach from currently attached session||^b d OR |
|^a ^d OR |
|rename-window to newname||^b , <newname> OR |
^b :rename-window <newname>
|^a A <newname>|
|list windows||^b w||^a w|
|list windows in chooseable menu||^a "|
|go to window #||^b #||^a #|
|go to last-active window||^b l||^a l|
|go to next window||^b n||^a n|
|go to previous window||^b p||^a p|
|see keybindings||^b ?||^a ?|
|list sessions||^b s OR |
tmux ls OR
|toggle visual bell||^a ^g|
|create another shell||^b c||^a c|
|exit current shell||^d||^d|
|split pane horizontally||^b "|
|split pane vertically||^b %|
|switch to another pane||^b o|
|kill the current pane||^b x OR (logout/^D)|
|close other panes except the current one||^b !|
|swap location of panes||^b ^o|
|show time||^b t|
|show numeric values of panes||^b q|