LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-06-2017, 03:42 AM   #1
akkki
LQ Newbie
 
Registered: Oct 2017
Posts: 12

Rep: Reputation: Disabled
Permission denied using ssh hostname@IPaddress


Hello all user,

I have one issue regarding ssh

If i run the command in my terminal

sudo ssh hostname@IPaddress
enter password:

Permission denied, please try again.

i got above error.
how can i fix this above error...

thanks and regards
akki.............
 
Old 11-06-2017, 04:37 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Check the top of the manual page for the general usage of the SSH client:

Code:
man ssh
You don't need and should not try to use sudo for this. It runs programs as other users and that won't do anything helpful here. Also, pay attention to where the user name and the hostname go.

Code:
ssh username@hostname
Alternately you can write the same thing like this:

Code:
ssh -l username hostname
Either way, the hostname goes last.

If you do not have a name for the remote machine, then you'll have to use an IP address instead of a hostname.
 
Old 11-06-2017, 05:33 AM   #3
akkki
LQ Newbie
 
Registered: Oct 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
if i trying without sudo samething happend....

ssh username@IPaddress
permission denied please try again


why it gives permission denied.......
how can i fix it


regards

Last edited by akkki; 11-06-2017 at 05:34 AM.
 
Old 11-06-2017, 05:46 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
The short answer is that you get that error because it is not letting you in, but you know that. If you have access to the server through other means, the sever's logs would tell you the specific reason. Do you have access to the server and its logs by other means?

Without such information, it is only possible to guess. Maybe the account on the server is locked. Otherwise, most likely either the user name or password is wrong.

You can get some limited information from running the SSH client in a more verbose mode using the -v option. But you will still need access to the server by other means to either make a valid user or unlock the existing account.

Code:
ssh -v username@hostname
Then look through the output for this section:

Code:
. . .
debug1: Authentications that can continue: . . .
. . .
debug1: No more authentication methods to try.
. . .
However, the server logs are the real place to look.
 
Old 11-06-2017, 06:02 AM   #5
akkki
LQ Newbie
 
Registered: Oct 2017
Posts: 12

Original Poster
Rep: Reputation: Disabled
This is my log when i run

ssh -v uname@ip


OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /home/naseem/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.1.234 [192.168.1.234] port 22.
debug1: Connection established.
debug1: identity file /home/naseem/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/naseem/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/naseem/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/naseem/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/naseem/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/naseem/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/naseem/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/naseem/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.234:22 as 'naseem'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:bnylOwuSjbdkmWUhJEvAwe8t5rb3k+leP5DiZImVabg
debug1: Host '192.168.1.234' is known and matches the ECDSA host key.
debug1: Found key in /home/naseem/.ssh/known_hosts:9
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/naseem/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/naseem/.ssh/id_dsa
debug1: Trying private key: /home/naseem/.ssh/id_ecdsa
debug1: Trying private key: /home/naseem/.ssh/id_ed25519
debug1: Next authentication method: password
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

how can i fix ,what is the problem
 
Old 11-06-2017, 06:11 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
The extra data shows that the machine is on the same LAN and you probably have physical access to it.

So you'll need to sit down over at the server and look at the SSH logs. If the server is Ubuntu they should be in /var/log/auth.log

Code:
less /var/log/auth.log
Or you can use awk to filter out everthing unrelated.

Code:
awk '$5~/^sshd/' /var/log/auth.log | less
There's not much you can do from the client at this point. The SSH server is doing its job and keeping you out. The question which can only be answered on the server itself is why.
 
Old 11-06-2017, 08:37 PM   #7
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
The first thing to check is whether the ssh server (sshd) is running on the target machine.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH permission denied bmorency Linux - Server 5 09-18-2015 07:02 AM
permission denied when ssh cjashu Linux - Server 1 05-01-2014 09:15 AM
ssh - Permission Denied? vendtagain Linux - Newbie 4 11-21-2009 09:28 PM
rsh <hostname> <script path> giving permission denied error shad.ithbti Linux - Newbie 5 08-31-2009 07:55 AM
SSH Permission Denied Chimney Linux - Security 1 11-10-2005 06:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration