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

learn more… | top users | synonyms

5
votes
2answers
8k views

bash shell - ssh remote script capture output and exit code?

I wish to use shell to invoke a script on a remote server. I would like to capture the output of that script (its logging messages) and the exit code it returns. If I do this: ssh user@server ...
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 ...
2
votes
1answer
603 views

SSH host key keeps changing

I am trying to set up a web service (using the Play Framework) on an Ubuntu machine on the network. However, I am experiencing intermittent failures connecting to it, not being able to connect to it ...
1
vote
1answer
510 views

How to ssh on multiple ipaddress and get the output and error on the local *nix machine?

command="ls -lrt;uname -a;uname -o" for i in 10.38.227.229 10.38.164.103 do ssh auto21@$i "$command 2>&1" >> log #ssh -n auto21@$i "$command" 2> >> log done i am trying ...
4
votes
1answer
2k views

SSH causes while loop to stop

I have finally managed to boil down a problem I have been struggling with for a few weeks. I use SSH with "authorized keys" to run commands remotely. All is fine except when I do it in a while loop. ...
1
vote
1answer
150 views

setup password less ssh between two accounts from third account

There are two unix accounts A and B. I want to configure password less ssh between these two accounts.This can be done without much pain but my problem is that there are mutiple accounts like A and B ...
1
vote
1answer
241 views

Mosh doesn't reconnect

I installed mosh on a desktop and server yesterday (compiled latest v1.2.3 from source) and it works fine. I left the session open yesterday and have come into the office today to find my mosh session ...
1
vote
1answer
71 views

Change order of Private Keys passed via SSH login

ssh -i ~/.ssh/username username@xx.xx.xx.xxx -v Server is set to accept only 3 log on tries. The ssh system is trying 3 identity files before attempting the correct identity file. debug2: key: ...
1
vote
1answer
680 views

SSH to machines in new subnet - connection timeout

I'm using RHEL4 and RHEL5. A new group of Linux machines are setup recently using 172.16.32.0/24. The existing RHEL machines are running on 172.16.1.0/22 and 172.16.4.0/22. When I try to ssh from ...
1
vote
1answer
194 views

Why I'm still able to use ssh reverse tunnel after closing reverse ssh connection?

I have created a reverse ssh tunnel to connect to a computer behind NAT using: ssh -R 9050:localhost:22 user@middleserver in the destination system. I closed the terminal that I entered this ...
2
votes
1answer
152 views

SSH to server, execute commands and give control back to user

How can I do something like this with one ssh command: echo << EOF echo "Choose a file:" * read f rm -r "$f" EOF | ssh user@host I can use the -tt (yes two t's) with ssh to make ssh read from ...
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 ...
14
votes
2answers
8k 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 ...
3
votes
1answer
469 views

Is there a way to find out how many instances of the root user are logged into a Linux machine?

We have a handful of users that login to our Linux virtual machine as root either through the vSphere client or through SSH and I want to see if there is a way to tell if multiple root users are ...
3
votes
3answers
387 views

Must I store a private key in a file?

I have a db-driven application that needs to communicate with another server via ssh. The web app can generate a keypair and give the user the pubkey, or it can accept the unencrypted private key in a ...
-1
votes
3answers
362 views

Limit find results in SSH

I using a line like this to search for a bunch of files: find . -name "page.php The results are hundreds of lines and I can't see it all. (I'm trying to just copy/paste it into excel to analyze ...
3
votes
1answer
321 views

Tunnel AFP over SSH over Internet

I can't seem to figure out how to connect to AFP over SSH. Here is my setup: [Raspberry Pi] <---> [router] <---> (Internet) <---> [Client] I'd like to be able to connect to my ...
1
vote
0answers
589 views

Use dd to backup disk image within an OpenVZ container

I want to use dd to backup the disk of an OpenVZ VPS in addition to traditional cold tar backups. Because I may need to migrate to a different VPS provider. From end user point of view, OpenVZ ...
1
vote
2answers
89 views

how to require sudo to view files?

I have a ssh server. I allow people to connect to it if they want. I do my programming homework on it. I am in trouble with my teacher because people were cheating off it. I need to know how to ...
1
vote
1answer
623 views

Session terminates immediately after authentication

I have a RedHat 5.3 server with several regular users created. Since last Friday the user "xpto" is getting "Authentication failed" error messages. Tha account isn't locked out. I have reset the ...
2
votes
2answers
496 views

Use desktop speakers over SSH from laptop

I have VLC media player and media files on a desktop CentOS 6.3 set up (without a GUI). I can play the media files at the machine but when I issue the command via SSH it is silent. I'm guessing it's ...
4
votes
2answers
252 views

Is it possible to store ssh connection in bash script instead of $(ssh user@ip command) every time?

I think that the code that I already have is not very efficient as it has to connect each time to the same machine and execute a command. Code: tmp=$(ssh -nq $USER@$IP "$COMMAND" 2>> $LOG) ...
1
vote
1answer
113 views

I hang when I try to ssh into a machine with my username (or su to my user) [closed]

Yesterday I was freely able to ssh into server box-a, and it seemingly froze on me today so I killed my putty instance. I am now unable to ssh into it. It ssh's but the prompt does not appear. I am ...
7
votes
3answers
336 views

OpenSSH - map aliases in ~/.ssh/config to IP addresses in command line

Is it possible to query ~/.ssh/config in the command line? Let's say I would like to retrieve what IP address does the particular alias point to in a separate program, is it possible?
3
votes
2answers
148 views

Any ideas to simplify the awkward rsync expression below?

Here is expression: rsync -avz --progress -e "ssh -i /where/is/my/id_dsa" vivek@some.host:`ssh -i /where/is/my/id_dsa vivek@some.host "find /remote/source/dir -type f -name '*.sql' | sort -nr | head ...
3
votes
0answers
1k views

The right way for dynamic ssh port-forwarding

Want my Firefox could use localhost:9099 proxy forwarded from vps server, why it doesn't it work this way? I always get bind: Address already in use $ ssh -vfND 127.0.0.2:9099 vpn OpenSSH_5.9p1, ...
5
votes
2answers
1k views

Regexp in .ssh/config

At work, I often have to log into hosts which follow a common naming scheme, e.g. qc01 - qc12, hc01 - hc10, and so on. All of these need to get the same config values in my laptop's .ssh/config. Of ...
4
votes
2answers
3k views

Executing a shell script from remote server on local machine

Imagine a shell script on the remote server as #!/bin/bash rm /test.x How can I (if possible) to execute this script from my local machine to delete /test.x file on my local machine. Obviously, the ...
1
vote
1answer
647 views

rsync to SFTP while moving completed uploads to another folder

I'm going to be moving a lot of data (30GB) to a server which is split up into multiple 200MB tar.gz files. This is going to take time, and I'm going to need to stop and start my computer again during ...
12
votes
2answers
5k 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 ...
0
votes
1answer
136 views

I'm only allowing pubkey auth via ssh. How can I still log in with password?

vi /etc/ssh/sshd_config egrep -i 'Pubkey|Password|Listen' /etc/ssh/sshd_config | grep -v '^#' ListenAddress 0.0.0.0 PermitRootLogin without-password PubkeyAuthentication yes ...
7
votes
2answers
6k views

SSHFS specify key

I've got a question that I've not been able to find an answer for. I have two computers, both of which run Ubuntu Linux 12.04. I have set up my first computer ("home") to be able to SSH into my second ...
3
votes
1answer
385 views

What should I check after an unauthorized access?

I accidentally left an open port on my router, leaving access to one of my computers via SSH, using a rather insecure password. I noticed because I checked /var/log/auth.log and there is just one ...
2
votes
1answer
735 views

SSH locking up: suspect local problem, not remote

On my work computer, I regularly SSH into two unrelated servers. Sometimes the SSH session locks up (does not respond to keyboard input). When locked up, I can SSH in via a second open terminal, that ...
3
votes
3answers
176 views

How secure my server is… should I worry? How to increase protection

I updated my server yesterday to a new version of CentoOS including a new version of DirectAdmin panel. This new installation comes with Brute Force Monitor service. As far as I see, this BFM ...
2
votes
2answers
1k views

SSH using keys in external storage - permissions?

I have a set of SSH keys to login to accounts and servers. However, ever since I moved my main work profile to a USB drive (for sync and ease of use among other reasons) I have been unable to directly ...
0
votes
2answers
5k views

User denied ssh access while in AllowUsers list

I've inherited the administration of a linux box in my workplace; it was set up by a colleague who is now gone. Recently, I added a new user to the system, and tried to give her ssh access as well; ...
2
votes
3answers
494 views

Is the id_rsa.pub file needed on client side?

If we would use: 1) password authentication through ssh 2) key auth - the public key's line are already in the servers authorized_keys Q: So in either these two ways, storing the public key is ...
1
vote
2answers
662 views

Tunnelling VPN through SSH mac

I have a pptp VPN server set up on my Raspberry Pi at home, and it works really well, except when I'm stuck behind my college's firewall. I can SSH into it through commonly open firewall ports (443, ...
1
vote
0answers
278 views

Making ChrootDirectory directory writable by SFTP user

If a user logs into a machine via SFTP, one can make use of ChrootDirectory keyword to give an illusion that user is in a root directory. But that directory is only writable by root user. I would love ...
4
votes
2answers
578 views

disabling ssh session expiration

I am installed Ubuntu on Virtual Box, and use xshell (a remote terminal application) to ssh to ubuntu. when I hibernate computer during night, after powering it on, the session is expired and I should ...
2
votes
3answers
2k views

Run local scripts on multiple servers using sudo user through a script

I have about 100 remote servers. I want to manage all my servers using one terminal server to update , run commands with sudo privileges. I need to have one main script that takes another test script ...
3
votes
1answer
566 views

How to safely replace one Linux distribution with another one via SSH?

I'm intending to replace a NAS's Custom Linux with Arch Linux (details at the bottom), of course wishing to preserve all user data and (due to the SSH-only headless access) attempting to be fool-proof ...
2
votes
2answers
579 views

Allowing ssh, but only to execute a specific script [duplicate]

Possible Duplicate: Creating a UNIX account which only executes one command There is a shell script which has to be executed through an existing user account XXX. Now I have various other ...
3
votes
2answers
2k views

How can I prevent SSH connection be closed by server for a user with nologin shell?

Basic info: Server OS: CentOS 6.3 Client tool: PuTTY I SSH to my server using PuTTY. I added an account with /sbin/nologin shell. When I log on to that account (selecting "never" close window on ...
0
votes
1answer
160 views

Using ssh_alias with ssh tunneling

I am using ssh tunneling to login to system behind gateway. Problem is that I have ssh_alias defined in ~/.ssh/config on gateway server. Where I have key and ip setup. But those alias don't work ...
2
votes
3answers
1k views

Is there a way to have regular expression in ~/.ssh/config

I have two set of server. Test on production. All server have internal ip. currently I am using alias to login: Host pro-10 Hostname 192.168.1.10 ProxyCommand ssh production-server nc %h %p For ...
1
vote
1answer
815 views

run a remote process via autossh in background

In Ubuntu I'm trying to run the geany editor on my local X display via the command: autossh -o StrictHostKeyChecking=false -XCg me@otherDYNDNShost geany & Trouble is, after the first ...
11
votes
4answers
617 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 ...
0
votes
2answers
1k views

I think somebody tried to hack me

root@host [/var/log]# tail -f secure Jan 3 20:16:10 host sshd[22670]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=61.142.131.120 user=root Jan 3 20:16:12 ...