SSH (Secure SHell) is a protocol for running commands on a remote computer.

learn more… | top users | synonyms

14
votes
7answers
29k views

Execute remote commands, completely detaching from the ssh connection

I have 2 computers, localpc and remoteserver. I need localpc to execute some commands on remoteserver. One of the things it needs to do is start a backup script that runs for a number of hours. I ...
14
votes
3answers
13k views

How can I tell what version of linux I'm using?

Often times I will ssh into a new client's box to make changes to their website configuration without knowing much about the server configuration. I have seen a few ways to get information about the ...
14
votes
2answers
7k views

Why SSH takes a long time to Connect

I have noticed that some Linux Servers in Network takes long time to connect using ssh. Situations:: There are two situations I have faced. 1: On some servers some times it takes a long time to ask ...
14
votes
2answers
897 views

Will my MySQL query continue to run even if my ssh connection drops?

I've connected to a server over SSH and logged in to mysql, and asked it to run a query (the results of which are dumped into a CSV) that could take well over an hour. Although I have instructed my ...
14
votes
1answer
1k views

How to prevent shutdown when an SSH user is logged in?

I'm administrating a networked environment and I had an interesting situation arise yesterday. When a host is required to shutdown by a regular user, it refuses to do so if other users are logged in ...
13
votes
8answers
1k views

How can we limit the impact of ssh probes?

My webserver is constantly attacked by various IP addresses. They try five passwords and then change the IP address. I have done various lockdowns like using ssh-keys and not permitting passwords, ...
13
votes
4answers
824 views

What is SSH - the protocol and what is ssh - the utility?

What is SSH - the protocol? What is ssh - the unix utility and how does it work? How is SSH protocol related to SFTP? What is sshd? Does the command su use ssh or sshd?
13
votes
6answers
4k views

How do I copy all files and directories except certain ones over ssh?

Using the Linux command line, I use the scp command to copy up all the files and folders from a certain directory. However, I don't like to consume wasted bandwidth for copying up things I rarely ...
13
votes
3answers
3k views

What are the pros/cons of the various methods to block brute force SSH attacks?

There are a number of different packages out there to shut out IPs from which brute-force SSH attacks are launched on your system. For example: DenyHosts Sshguard fail2ban What are the pros/cons ...
13
votes
2answers
2k views

(SSH) Is it dangerous to close terminal without “exit”?

This happened many times. While the SSH active, I'm so tired and just close the terminal without exit Is it dangerous to doing like that?
13
votes
2answers
5k views

How can I determine if someone's SSH key contains an empty passphrase?

Some of my Linux & FreeBSD systems have dozens of users. Staff will use these "ssh gateway" nodes to SSH into other internal servers. We're concerned that some of these people use an unencrypted ...
13
votes
2answers
6k views

How do I know if my ssh tunnel is created successfully?

I rely on the following script tunnel.sh written by others to keep a ssh tunnel alive: #!/bin/bash export SSH_HOST=tim@server if [ ! -f /tmp/.tunnel ] then echo "Creat SSH tunnel" ssh -f -D 9999 ...
12
votes
5answers
652 views

what's the purpose of ssh-agent?

I've read the official definition: ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA, ECDSA). The idea is that ssh-agent is started in the beginning of an ...
12
votes
2answers
24k views

Is there a command to list all open displays on a machine?

When SSH'd locally into my computer (don't ask, it's a workaround), I can't start graphical applications without running: export DISPLAY=:0.0 If I run this first and then run a graphical ...
12
votes
3answers
9k views

How do you copy the public key to a ssh-server?

Here is what I have tried, and I got an error: $ cat /home/tim/.ssh/id_rsa.pub | ssh tim@just.some.other.server 'cat >> .ssh/authorized_keys' Password: cat: >>: No such file or directory ...
12
votes
3answers
14k views

Which users are allowed to log in via SSH by default?

When I set up my Debian 6, I was wondering, which users apart from root whose password I know can log into my system via SSH? When I install Apache 2 a user called www-data gets created. Does this ...
12
votes
3answers
7k views

Encrypting file only with SSH -priv-key?

Suppose I want to encrypt a file so that only I can read it, by knowing my SSH private key password. I am sharing a repo where I want to encrypt or obfuscate sensitive information. By that, I mean ...
12
votes
4answers
15k views

How to delete a file on remote machine via SSH by using a Shell Script?

I am writing a Shell Script where I have to delete a file on a remote machine via a Shell Script. Flow manually: ssh username@domain.com .. then at domain: cd ./some/where rm some_file.war How ...
12
votes
5answers
16k views

How to download a file through an SSH server?

I have a server in USA (Linux box B), and my home PC (Linux box A), and I need download a file from website C, The issue is, it is very slow to download a file direct from A, so I need download the ...
12
votes
3answers
6k views

Answer yes in a bash script

I'm trying to do a git clone trough a bash script, but the first time that I run the script and the server is not known yet the script fails. I have something like this: yes | git clone ...
12
votes
4answers
5k views

Can I pipe /dev/video over ssh

I have two computers, a desktop in my office ( with a webcam attached ) and a laptop somewhere else on the network. Usually I take a look at my office through my webcam by running ssh Office -Y ...
12
votes
1answer
4k views

How can I configure a reverse SSH connection to the connecting computer?

I'm going to be deploying a number of machines in the near future which will be behind routers. It won't be feasible to set up dynamic DNS on each router and port forwarding, so is there a way I can ...
12
votes
3answers
2k views

Can SSH passwords be sniffed out over Wi-Fi?

When you ssh, can the password you enter to connect, be intercepted if you're using untrusted public Wi-Fi (coffee shop, library, airport, etc).
12
votes
4answers
6k views

How can I solve this ssh-agent problem?

I'm using Linux Mint, and have not been able to get gnome-keyring to unlock automatically at login, it seems. A symptom of my problem is as follows: $ ssh-add Identity added: /home/me/.ssh/id_rsa ...
11
votes
3answers
8k views

SCP from one server to another without password prompt

What is the best way of doing SCP from one box to the other without prompting for password? There are two servers: Server A (10.152.2.10): /home/oracle/export/files.txt Server B (10.152.2.11): ...
11
votes
4answers
3k views

Does a `scp` transfer close when I close the shell?

I have scp transfer (from one remote server to another), that is quite big. So maybe I want close the computer from which I executed this command, will this end the transfer? I have ssh access to ...
11
votes
2answers
592 views

How to terminate remotely called “tail -f” when connection is closed?

I just noticed that if I execute ssh user@remote_host tail -f /some/file , then tail -f /some/file keeps running on the remote_host even if ssh connection is closed! So, after several connects and ...
11
votes
3answers
9k views

How can I run ssh-add automatically, without password prompt?

I want to communicate between several computers on my network (static ethernet), through ssh. In order to do that I need to run ssh-add every time I login on specific machine, how can I do it so that ...
11
votes
2answers
4k views

Multiple similar entries in ssh config

Say I want to configure my ssh options for 30 servers with the same setup in my .ssh config file: host XXX HostName XXX.YYY.com User my_username Compression yes Ciphers ...
11
votes
2answers
621 views

Understanding SSH tunnels

I have linux (Ubuntu) server which I have root access to through ssh (port 22) only. On that server there is a MySQL database listening on port 3306. Is it possible to use putty (on my machine) and ...
11
votes
3answers
3k views

How to execute a remote command and pass in local file as input?

Is it possible to do this: ssh user@socket command /path/to/file/on/local/machine That is to say, I want to execute a remote command using a local file in one step, without first using scp to copy ...
11
votes
4answers
2k views

OS X: how to keep the computer from sleeping during a ssh session

When I ssh into a OS X computer on my network the session lasts until the OS X goes into sleep mode. Is there a way to prevent this from happening during my SSH session, apart from physically bumping ...
11
votes
3answers
16k views

Can I connect to Windows machine from Linux shell?

I can connect to Linux machines from Windows using PuTTY/SSH. I want to do the other way round - connect to a Windows machine from Linux. Is this possible?
11
votes
1answer
2k views

Is there an easy way to update information in known_hosts when you know that a hosts key has changed?

If a host's operating system has been re-installed and had its public key regenerated sshing to it will of course fail because the new key doesn't match the old one. Is there an easier way to tell ...
11
votes
5answers
2k views

How to copy a file that is still being written over ssh?

Here is the situation: I am uploading a large file from client A to a server using sftp. I also need to download this file from the server to client B over ssh. What I would like to do is start ...
11
votes
1answer
3k views

Limits of SSH multiplexing

I have the following entry in my .ssh/config file Host AAA User BBB HostName CCC ControlMaster auto ControlPath ~/.ssh/%r@%h:%p The above allows me to multiplex multiple ssh ...
11
votes
3answers
1k views

Adding a user who can only execute scripts remotely

I would like to create a user who can only do one thing: via ssh specify a script ( and commandline arguments to the script ) that resides in one particular folder ( for the purposes of this question ...
11
votes
3answers
598 views

Groups differ from the local ones when logging in remotely

We store our users in LDAP, alongside some groups that have meaning across different systems (organizational roles including wheel). There are also groups local to workstations, e.g. audio or video ...
10
votes
4answers
1k views

How do I trigger autocomplete without a tab key?

I'm ssh-ing to my machine using my iPhone with an app called ServerAuditior. It doesn't have tab key. See screenshot. How do I trigger autocomplete without the tab key? I don't want to type a lot of ...
10
votes
2answers
746 views

How to temporarily switch from ssh to my local shell?

I'm using cygwin. and use it with ssh to login into a ubuntu server. sometimes, I want to switch back to my cygwin and then quickly switch to ubuntu shell. How to do this?
10
votes
3answers
3k views

How to close (kill) ssh ControlMaster connections manually

With the following .ssh/config configuration: ControlMaster auto ControlPath /tmp/ssh_mux_%h_%p_%r ControlPersist 4h How to close the persisting connection before the 4 hours? I know you can make ...
10
votes
4answers
313 views

Is my SSH key paired with me as a human, or with my user account on one machine?

In the past few days, I have been trying to acquaint myself with SSH, and I hope that I've understood it. One question remains, however -- is my key associated with me (as the user) or my user ...
10
votes
3answers
3k views

How can I make a user able to log in with ssh keys but not with a password?

I would like to create a user and have no password. As in you cant log in with a password. I want to add keys to its authorized_keys by using root. This is for my automated backup system.
10
votes
6answers
359 views

SSH automatic remote back ups

I have two machines, A and B. Machine A can ssh into B. A has a lot of free space. B's data is in a sort of risky situation. How do I back up all of B's data to A automatically. It does not have to ...
10
votes
2answers
7k views

What difference between openssh key and putty key?

I've found ssh-keygen ("ssh" package) comand produce another keys that puttygen command ("putty" package). If I create public and private keys with ssh-keygen some ssh-servers can not accept my keys. ...
10
votes
4answers
5k views

Given keys in ~/.ssh/authorized_keys format, can you determine key strength easily?

~/.ssh/authorized_keys[2] contains the list of public keys. Unfortunately, each public key does not specify the key strength ( number of bits ). Is there a utility that can process this file line by ...
10
votes
1answer
6k views

How to list keys added to ssh-agent with ssh-add?

How and where can I check what keys have been added with ssh-add to my ssh-agent ?
10
votes
4answers
6k views

rsync all files of remote machine over SSH without root user?

I have this command to backup a remote machine. The problem is that I need root rights to read and copy all files. I have no root user enabled for security reasons and use sudo the Ubuntu way. Would I ...
10
votes
1answer
4k views

Convert OpenSSH private key into SSH2 private key

Is there a way to convert existing pair of OpenSSH keys to the SSH2 (ssh.com format) pair of keys? UPD: since there are some answers about ssh-keygen suddenly appeared, I'll explain where I came ...
10
votes
3answers
1k views

How can I lock my own account from remote ssh login with password?

I don't want to disable remote login with password altogether, but I want to make it so that my account is only accessible with key pair authentication (there are other users who wants to use ...