Tag Info

New answers tagged

0

If you use shorewall as your firewall, you can do this with connection rate limiting. Here is a sample configuration and explanation: ############################################################################################################################ #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL ...


3

Curl can display the file the same way cat would. No need to delete the file since it simply displayed the output unless you tell it to do otherwise. curl -u username:password sftp://hostname/path/to/file.txt If you use public key authentication: curl -u username: --key ~/.ssh/id_rsa --pubkey sftp://hostname/path/to/file.txt If you use the default ...


1

I think you're confusing the various technologies and how they work. I wouldn't expect that the notification daemon from one system could send messages via SSH. Setting the $DISPLAY is how X11 sends the output from an application to another for displaying purposes, but the notify-send is sending an actual message to the notification daemon. This message is ...


1

In order for two machines to communicate, they need to know each other's IP address. That's how they know where to send packets. You can't communicate with someone if you don't know where to send their messages. Tunneling allows machines to communicate without knowing each other's IP address by embedding packets inside another communication layer and using ...


0

Since you can't guarantee that an SSH connection (being TCP) will remain alive once one end stops sending ACKs to received packets, I personally use http://www.harding.motd.ca/autossh/ to restart all my SSH connections almost as soon as I unsuspend. Since GNU Screen will be in use on the server side, re-attaching gets me to where I was before. You can have ...


1

I've figured out what's going on. The messages are coming to the server from remote hosts via UDP. I didn't notice the host field changing at first, my mistake. BTW, actually there is a possibility to login using public key authentication with no authorized_keys file involved. RedHat (and variants) have a supported patch for OpenSSH that adds the ...


1

Use fail2ban which uses the firewall to disable access to ssh (and optionally, other services) after a certain number of failed attempts. By default, it blocks for 30 minutes after 3 failed attempts, but is configurable using (I believe) the maxretry value.


3

Try xpra. This is similar to ssh -X, except it is faster and you can disconnect and re-connect to the session as many times as you like.


1

If you can install the rlwrap utility, then it is as simple as doing rlwrap ./yourscript.sh This will allow you to use the up and down array keys to browse through history, as well as the right and left arrow keys for editing the current command, for programs that do not support it already.


0

According to this web page vSphere Client is available only for Windows. The web page gives options on how to use vSphere Web client on Linux.


1

You've edited the file /etc/passwd with a Windows editor, or with an editor configured to produce Windows files. Don't do that. Windows uses the two-character sequence CR-LF to represent a line break, whereas Linux and other unix systems use just LF and see that CR as an ordinary character that happens to be last on its line. Generally speaking, use a Linux ...


-2

In addition to Arcege's answer, you can also use sudo su <enter password> cd .ssh The sudo command (without another user name) allows you to run commands as the super-user (root), provided you are a sudo-er (your user name is in /etc/sudoers with the correct fields) and know the password to that sudo-enabled user. Warning: Operating as the ...


1

Since you have "Permission denied" on a directory, it is likely that the directory does not have execute permissions. Similarly, to traverse a directory tree to get at a file, you would need execute permissions on each directory in between the root and the file (hence the same error for the other command). Try setting the execute permissions on the ...


0

a.First log in on A as user a and generate a pair of authentication keys b.Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine) ssh b@B mkdir -p .ssh b@B's password c. Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time: cat .ssh/id_rsa.pub | ssh b@B ...


1

to avoid SSH password promts: sudo apt-get install sshpass An alternative tool for package installation is dpkg download the sshpass deb packet and install it: sudo dpkg -i sshpass_1.04-1_amd64.deb pattern to use as follows: sshpass -p mypassword ssh user@server if needed to avoid sudo password promt: ssh uder@server-abc.com "echo sudo_password | ...


0

For a passwordless login you should create an SSH Keygen. For more information on the subject and how to do it see : https://help.github.com/articles/generating-ssh-keys.


1

Try the following when logged in: su root Then you login as root. When this works, you can edit the passwd file.


1

Does it accept the password from the console? you might have upgraded your system and your sshd_config might have been replaced. By default root access through ssh is disabled. By the way, the password is not stored in /etc/passwd, it is stored in /etc/shadow. The only thing affected would be your login shell which is what is the last field of /etc/passwd ...


0

I had the same problem on a Synology DS212j, solved using the 3rd part package "config file editor". You can download the package from here . Remember to add /etc/passwd in the "Config file editor" configuration file, (it is the last one in the file list)


1

Why are the SSH variables set? It is likely that the variables are set because your VNC connection is tunneled through an SSH connection. There are good reasons to do this. VNC uses the RFB protocol which is not secure. Tunneling VNC through SSH improves security. Why is the SSH_CONNECTION variable the same? The SSH_CONNECTION variable consists of four ...


5

if I get the question in a right way, you want your server to be reachable only from specific IP address on port 22, you can update Iptables for this: iptables -I INPUT -p tcp -s YourIP --dport 22 -j ACCEPT In that case, you are opening ssh port only to YourIP, if you need to open DNS for your internal network: iptables -I INPUT -p udp -s YourIP --dport ...


2

Though I recommend using SSH keys, I will give you an explanation. You don't have to use IPtables for what you're trying to achieve, there are multiple ways. This is the IPtables way: iptables -I INPUT -s [YOUR_HOME_IP] -p tcp -m tcp --dport [SSH_PORT] -j ACCEPT [YOUR_HOME_IP] = Your home IP (pretty straightforward) [SSH_PORT] = The port that you run SSH ...


2

Depending on your SSH configuration (usually defined in /etc/ssh/sshd_config) root access may be disabled in a number of ways: No root access at all (PermitRootLogin=No or DenyUsers root) root is allowed access, but only via key-pair authentication (PermitRootLogin=without-password or PasswordAuthentication=no) root access is allowed, but only specific ...


1

This can't be done to my knowledge in the ssh config file. However, if you ssh into host1 and edit root's .bashrc file, you can accomplish the same thing. [root@host1] $ echo "cd /var/www/dir0/dir1/" >> ~root/.bashrc Then exit and ssh back in to verify it works for you.


1

Here's a simple way that doesn't preserve metadata: ssh server.example.com 'set -C; cat >/path/to/remote/file' </path/to/local/file You can do it with rsync with the right options. The return code will be 0 if the file exists, but you can find out from the verbose output instead. changes=$(rsync -a --ignore-existing --itemize-changes \ ...


1

You'll need to loop infinitely, but prevent the script from running again when you are done. while ((1)); do script.sh; sleep 3; done The three second sleep gives you an opportunity to break the loop. When you're done with ssh, exit. In three seconds, the script will start again. If you don't want that to happen, Ctrl-C will stop the loop.


2

Recursion is rarely the answer to anything :-) What you are trying to do can be done via a simple loop while :; do ssh $host done Whenever ssh exits, the script will go to the next iteration of the loop, and re-execute it. In while :, the : is a noop command that always returns a true value, so the while will never end. If you need some way of ...


-1

Check if the file exists on the remote host first: if ! ssh remotehost [ -f incoming/DB1026910.sql ]; then scp DB1026910.sql remotehost:incoming/ fi


0

It's quite easy for "publickey->password->your_module" or "password->your_module". Can't find the way to remove password from the first chain publickey,keyboard-interactive - means that publickey auth will be used and keyboard-interactive after that (kind of logical AND), replace comma with space for logical OR, like AuthenticationMethods ...


7

EC2 instances use an internal 10.X.X.X address (or other address if using a VPC), and traffic to their 'public' IP address is simply re-routed to the internal IP address. EC2 instances also use a different DNS server that is not publicly accessible. When you resolve the hostname of the other EC2 instance, because you're inside the AWS network, it gives you ...


6

Your username in the VM is different than your username on the Mac. By default, ssh assumes the usernames are the same if you don't specify it explicitly. It's trying to log in to a user that doesn't exist (or that you haven't set up), which is why it always fails. To avoid that, you can either specify the username each time, or set up your .ssh/config file ...


0

Choose an unused local facility. For example local3 is not used for any logging in your system. So first edit /etc/sshd_config configuration file. #SyslogFacility AUTH SyslogFacility local3 Now configure rsyslog to log local3 logs to a file that you need. Add the following to your /etc/rsyslog.conf . #Logging sshd to another file. Using local3 ...


2

There seems to be a lot of confusion on the difference between a host key, and a user key. A host key is used to establish the identity of the remote host to you. A user key is used to establish the identity of yourself to the remote host. Since these keys are typically shown as just a sequence of characters, it can be difficult for a human to tell at a ...


1

I eventually found the answer for myself on this page. The machine I was running rtorrent on had Ctrl-S and Ctrl-Q mapped to stop and start screen output. Unmapping these got things working again.


1

Without sudo the command doesn't have privileges to capture the device: tcpdump: eth0: You don't have permission to capture on that device But with sudo it would, but being run after ssh, it never gets password input for sudo on the remote server, so the solution is use -S (man sudo) and pipe password for sudo as follows: ssh john@server-abc.com "echo ...


2

If you use a custom shell as suggested by Arcege and 2bc, then that shell will receive the command which the user intends to execute as an argument because the shell is invoked like this: shellname -c the_original_command So ignore the -c (that your $1) and find the command in $2. For example: #!/bin/sh case "$2" in on) do something ...


3

With this simple loop you can automate it and spread to all remote servers. #!/bin/bash for ip in `cat /home/list_of_servers`; do ssh-copy-id -i ~/.ssh/id_rsa.pub $ip done


1

For copying your public key, you have something in-built in openssh itself. So instead of cat and ssh use this :- ssh-copy-id -i ~/.ssh/id_rsa.pub YOUR-REMOTE-HOST


2

You can run this command via sudo on the server to capture the data first, and then send the resulting file back to your workstation to review the data sudo tcpdump -i eth0 -s 65535 -w /tmp/wireshark


10

This was explained in this question: http://superuser.com/questions/22535/what-is-randomart-produced-by-ssh-keygen. It doesn't really have any use for the user generating the key, rather it's for ease of validation. Personally. would you rather look at this: (Please note this is a host key example) 2048 1b:b8:c2:f4:7b:b5:44:be:fa:64:d6:eb:e6:2f:b8:fa ...


0

Use public/private keys. To do that you will need to generate a key using ssh-keygen (man for the documentation) once you have generated the key you will have (assuming you have generated an rsa key) and id_rsa file (your private key) and an id_rsa.pub (your public key) copy the public key to /home/xxxx/.ssh/authorized_keys. Now you will be able to log in ...


2

You can access environment variables in your vimrc using $NAME. ssh sets the environment variable SSH_CONNECTION within an SSH session to non-empty metadata about the connection. You can combine these two to run configuration code based on whether you're accessing vim over SSH or not: if $SSH_CONNECTION colorscheme solarized endif The body of the if ...


3

Maybe this is not helpful in your exact case, but I often simply use sum -r on each machine, and manually compare the checksums. That allows for comparisons of files even when they are not reachable via an ssh connection. Of course, all it answers is "are they identical", but often that is sufficient for my needs. It also makes it easy to verify that a ...


6

Try: diff local_file <(ssh user@server 'cat remote_file') or using vimdiff: vimdiff local_file scp://server//path/to/remote_file


10

ssh user@remote_host "cat remote_file.txt" | diff - local_file.txt Source


0

I made a video to show to use a smart card with a Linux server using PuttySC and SecureCRT. You can watch it here: How to SSH with your Smart Card I do not explain how to provision a certificate in the card, but if you do, remember the admin key of the card should be changed using a Card Management System. It will be a lot easier for you if your company ...


4

For passwordless connections with ssh you need to : use ssh-keygen to generate your public key. use ssh-copy-id to copy the public key to the remote machine.


0

When I do it from sftp with the ! prefix, it says it's worked It has! But ! executes the command on the client, not on the server. So watch out for what you may inadvertently have changed on the client. The SFTP protocol deliberately doesn't allow the client to specify commands to run on the server. It's only a file transfer protocol. You may however ...


3

This question looks very confused, but I think the confusion is part of the question, so I'll try to provide enough background to clarify things. HTTP and SSH are different protocols. HTTP is spoken by HTTP clients (called web browsers) and HTTP servers (called web servers). SSH is spoken by SSH clients and SSH servers. The HTTP protocol has a notion of ...


0

SSH itself doesn't check source IP addresses under any circumstances, to my knowledge (they can be spoofed anyway). So you'd probably have to use a packet filter on B (e.g. iptables) and set it up so that incoming TCP packets with destination port 1235 must have B as their source address.



Top 50 recent answers are included