顯示具有 ssh 標籤的文章。 顯示所有文章
顯示具有 ssh 標籤的文章。 顯示所有文章

2015年12月21日 星期一

[ssh] no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

Q:
[happy@localhost happy]$ ssh 192.168.1.1
Unable to negotiate with 192.168.1.1: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

A:
[happy@localhost happy]$ ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 admin@192.168.1.1


Reference:

2015年10月26日 星期一

2015年4月20日 星期一

[SFTP] Transferring Files with SFTP

How to Connect with SFTP
ssh username@remote_hostname_or_IP

Transferring Remote Files to the Local System
get remoteFile Local path

Copy a directory and all of its contents by specifying the recursive option:
get -r someDirectory

Appropriate permissions and access times by using the “-P” or “-p” flag
get -Pr someDirectory

Transferring Local Files to the Remote System
put localFile

Copy an entire local directory, you can issue:
put -r localDirectory

Reference:

2015年4月15日 星期三

2015年2月9日 星期一

2015年1月16日 星期五

2014年12月19日 星期五

2014年5月22日 星期四

2014年5月8日 星期四

[Embedded][ssh] Can't login Embedded Board


[Embedded][ssh] Can't login Embedded Board



Question : Alway need to input password



ssh root@192.168.100.1

root@192.168.100.1's password:

WARNING: Your password has expired.

You must change your password now and login again!

Changing password for root

New password:

passwd: password for root is unchanged

Connection to 192.168.100.1 closed.



Solve :

vi /etc/shadow

sed 's/0:0/100:100/g' -i /etc/shadow



Reference :






 


2014年4月29日 星期二

[sshfs][sftp] Configure sshfs on Embedded


Question :

sshfs root@192.168.100.1:/ /home/happy/folder/ can't connect.


Solution :


1. Debug by using sftp at the first.

sftp -vvv root@192.168.100.1


debug1: Exit status 141

Connection closed


2. Go to Embedded Board, then edit sshd_config.

Change

Subsystem     sftp    /tmp/BIN/libexec/sftp-server   -->  Subsystem sftp internal-sftp

3. Embedded Board :

Start sshd

/tmp/BIN/sbin/sshd -f /tmp/BIN/etc/sshd_config -h /tmp/BIN/bin/ssh_host_rsa_key -D


4. Go to PC, then execute sshfs root@192.168.100.1:/ /home/happy/folder/ successfully.


Reference :


2013年12月27日 星期五

2013年4月25日 星期四

[ssh] Solve "Agent admitted failure to sign using the key"


ssh -T git@github.com (Tutor : Generating SSH Keys - must add ssh key to github)


Agent admitted failure to sign using the key.

Permission denied (publickey).

ssh-add

Identity added: /home/ABC123/.ssh/id_rsa (/home/ABC123/.ssh/id_rsa)


ssh -T git@github.com

Hi ABC123! You've successfully authenticated, but GitHub does not provide shell access.


Reference :


2013年3月17日 星期日

[sshd] How to let sshd start up on system boot

Create or modify the /etc/init.d/sshd init script as follows:

#! /bin/sh
#
# start/stop the secure shell daemon

case "$1" in
'start')

 # Start the ssh daemon
 if [ -x /usr/sbin/sshd ]; then
  echo "starting SSHD daemon"
  /usr/sbin/sshd &
 fi
 ;;

'stop')
 # Stop the ssh daemon
 /usr/bin/pkill -x sshd
 ;;
*)
 echo "usage: /etc/init.d/sshd {start|stop}"
        ;;
esac

Check that /etc/rc3.d/S89sshd exists (or any sshd startup script exists) and is a soft link to /etc/init.d/sshd.

If not, create it using the following command:

  ln -s /etc/init.d/sshd /etc/rc3.d/S89sshd

Reference :

2013年2月21日 星期四

[SSH] How to ssh without password

Generate a rsa keypair:
# ssh-keygen (Local machine create rsa keypair)

Generate two key (private and public key)

Your identification has been saved in ~/.ssh/id_rsa
Your public key has been saved in ~/.ssh/id_rsa.pub


then copy it on the server with one simple command:

# ssh-copy-id Remote_Account@Remote_IP_Address (ex : ssh-copy-id root@192.168.100.100)
or
cat ~/.ssh/id_rsa.pub to <Remote Server> .ssh/authorized_keys


Check -- you can now log in without password:
# ssh hostname (ex : ssh root@192.168.100.100 or ssh 192.168.100.100 -l root)


Reference :

2012年12月17日 星期一

[ssh][ubuntu] Send command to Remote Machine by using ssh

happy@happy-laptop:~$ ssh root@192.168.0.1 'ls -l'
root@192.168.0.1's password:

總計 120
-rwxrwxrwx. 1 root root  1706 2012-09-13 19:56 anaconda-ks.cfg
drwxr-xr-x  2 root root  4096 2012-12-11 14:44 Desktop
drwxr-xr-x  2 root root  4096 2012-12-11 14:44 Documents
drwxr-xr-x  2 root root  4096 2012-12-11 14:44 Downloads
-rwxrwxrwx. 1 root root 68774 2012-09-13 19:55 install.log
-rwxrwxrwx. 1 root root 10782 2012-09-13 19:55 install.log.syslog
drwxr-xr-x  2 root root  4096 2012-12-11 14:44 Music
drwxr-xr-x  2 root root  4096 2012-12-11 14:44 Pictures
drwxr-xr-x  2 root root  4096 2012-12-11 14:44 Public
drwxr-xr-x  2 root root  4096 2012-12-11 14:44 Templates
drwxr-xr-x  2 root root  4096 2012-12-11 14:44 Videos

happy@happy-laptop:~$

Reference :
  1. Send Remote Commands Via SSH

2012年9月22日 星期六

[ssh][Linux] How to quick ssh to remote server without input password


Auto Script to create and scp to remote server

#!/bin/bash

echo -n "Input Server IP : "

read Server_IP

echo -n "Input login name : "

read login_name



if ! test -e ~/.ssh/authorized_keys; then

    ssh-keygen -t dsa

    cd ~/.ssh

    cat id_dsa.pub >> authorized_keys

fi



# Create a directory on remote server

echo "Create a directory on remote server"

ssh $Server_IP -l $login_name "mkdir .ssh"



# Copy authorized_keys to remote server

echo "Copy authorized_keys to remote server"

cd ~/.ssh

scp authorized_keys root@$Server_IP:~/.ssh



# Login into the server

echo "Login into the server"

ssh $Server_IP -l $login_name



Product public key and private key at client.



Happy@Happy-laptop:~$ ssh-keygen -t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/home/Happy/.ssh/id_dsa):            

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/Happy/.ssh/id_dsa.

Your public key has been saved in /home/Happy/.ssh/id_dsa.pub.

The key fingerprint is:

4d:9c:75:b5:63:d7:32:fc:3b:8b:e2:29:55:f9:70:91 Happy@Happy-laptop

The key's randomart image is:

+--[ DSA 1024]----+

|            . ..o|

|         . o o Eo|

|          +   =++|

|         o   +.=o|

|        S . . + .|

|           .   ..|

|          .    o |

|         . .. . o|

|          oo.. . |

+-----------------+



Copy public key to Server



cd ~/.ssh

scp id_dsa.pub root@192.168.1.19:~/



ssh to server, cp public key to authorized_keys



ssh 192.168.1.1

cat id_dsa.pub >> .ssh/authorized_keys



Reference:





2012年6月16日 星期六