Tag Info

Hot answers tagged

20

Rather than type your password multiple times you can make use of pssh and its -A switch to prompt for it once, and then feed the password to all the servers in a list. NOTE: Using this method doesn't allow you to use ssh-copy-id, however, so you'll need to roll your own method for appending your SSH pub key file to your remote account's ...


9

I don't think any implementation of ssh has a native way to pass a command from client to server without involving a shell. Now, things can get easier if you can tell the remote shell to only run a specific interpreter (like sh, for which we know the expected syntax) and give the code to execute by another mean. That other mean can be for instance standard ...


5

Alternative using xargs, sshpass and ssh-copy-id: Assuming your credentials living in credentials.txt in format user:password@server: $ cat credentials.txt root:insecure@192.168.0.1 foo:insecure@192.168.0.2 bar:realsecure@192.168.0.3 You could do: tr ':@' '\n' < credentials.txt \ | xargs -L3 sh -c 'sshpass -p $1 ssh-copy-id $0@$2' Note: ...


4

You can use scp -r to copy files recursively between different hosts. Your syntax could be like scp -r user@Ubuntu-Server:/home/myuser ./from_Ubuntu_server Besides, you might be able to upload your local rsync binary using scp to the Ubuntu server and add the --rsync-path=/home/myuser/rsync to your original rsync command to let your client rsync know which ...


4

ClusterSSH gives you a window on each machine and with a common window to control all windows. If we are talking 10 machines this will work. If we are talking 100 machines, there will be to many windows. The beauty of ClusterSSH is that if one machine is not 100% like the rest, you can just click the window, and send keystrokes only to that machine before ...


3

What you're asking for does not seem to make sense. Here I want to get root because the remote user is now root No, the remote user is now root. The fact that you've done sudo -s on the local system doesn't change that you're ssh'ing into the soyuka account remotely. The answer for "Here I want to get /home/soyuka/downloads" is similar. Is this ...


3

With ssh -D 8080 yourserver you can start a SOCKS proxy to your home server. Configure your client to use localhost:8080 as SOCKS proxy.


3

Using Ansible is fairly simple. Just replace <USER> with the real login name $ cd /path/to/public/key $ cat<<END > hosts host1.example.com 10.10.10.10 END $ ansible -i hosts all --ask-pass -u <USER> -m authorized_key -a "user=<USER> key='$(cat id_rsa.pub)'"


2

I often use SSH port tunneling to create an encrypted channel. Since you're using an rsync:// URL I assume you have the rsync daemon running on TCP port 873 on the remote server. We can forward this port as follows: ssh -N -L 873:localhost:873 rsyncssh@server The -N option prevents the execution of a remote command, which would in your case disconnect the ...


2

This looks like the linux host is configured to be some sort of RDP gateway. The command will initiate a SSH session to itself (root@localhost), start a local listener on port 3300 (L 3300:) to forward all traffic to a Windows machine on port 3389 (remote_WIN_machine1:3389), typical for RDP. I suspect that the GatewayPorts directive is set to yes in ...


2

You can use a tar and ssh combintaion like this: sudo tar cvzf - folder/ | ssh -C user_name@host_name "cd ~/; tar xvzf -"


1

You can use "Hola better internet" extension for Chrome browser.


1

Using \$HOSTNAME is the correct way to escape the variable in this case. However, that variable often contains the hostname (non-fqdn), or may not be populated. You should rather use the command hostname -f to get your server FQDN. I don't know how will look like your final script, but connecting to server1 then check if this server is server1 may be some ...


1

I need advice/best practice on how I can avoid keying in passphrase when I add this crontab to run everyday. Create a new ssh key with an empty password, specially for this task. Save it in a file, say, ~/.ssh/cron. Add its corresponding public key to ~/.ssh/authorized_keys on the remote machine. When you run your scp from cron(8) do it with the new ...


1

If you have the permission to use FUSE on your local machine, install the sshfs package. SSHFS lets you access remote files via normal filesystem access: it mounts a directory tree accessed over SFTP. You only need to have SFTP access on the remote side (which is enabled by default with OpenSSH on Ubuntu). Once the remote directory is mounted, you can use ...


1

This is entirely an issue with the command not being in your PATH. Unlike Windows systems the current directory is not implicitly in the search path for executables. To run a command such as ls (eg ls -l) it needs to be in your PATH, and indeed it is - type ls will show you it's either in /bin or /usr/bin. However, some.cmd is not in your PATH and so cannot ...


1

To make it work on other platforms this became the final solution. It checks if the ssh client disconnected and thus the parent became pid 1: $SIG{CHLD} = sub { $done = 1; }; $pid = fork; unless($pid) { # Make own process group to be able to kill HUP it later setpgrp; exec $ENV{SHELL}, "-c", ($bashfunc."@ARGV"); die "exec: $!\n"; } do { ...



Only top voted, non community-wiki answers of a minimum length are eligible