Mark
Mark

Reputation:

How to verify if SFTP access has been granted on a server

How can we verify that SFTP access has been granted on a server, without installing any software/tools?

Upvotes: 23

Views: 121438

Answers (6)

Karthikeyan Iyer
Karthikeyan Iyer

Reputation: 141

One of the many ways to check for SFTP access using password based authentication:

sftp username@serverName

or

sftp username@serverIP

And then entering password.

You will get "Permission denied, please try again." message if it fails otherwise you will be allowed inside the server with screen-

sftp>

You can test it fully works with commands like ls, mkdir etc.

Upvotes: 13

tomlarmon
tomlarmon

Reputation: 205

Alternatively, other than doing the "sftp -v" command mentioned above, you can always cat the SSH/SFTP logs stored on any server running sshd and direct them to a file for viewing.

A command set like the following would work, where 1.1.1 would be the /24 of the block you are trying to search.

cd /var/log/
cat secure.4 secure.3 secure.2 secure.1 secure |grep sshd| grep -v 1.1.1> /tmp/secure.sshd.txt
gzip -9 /tmp/secure.sshd.txt

Upvotes: 1

john
john

Reputation: 1383

In SFTP , the authentication can be of following types : 1. Password based authetication 2. Key based authentication

But if u r going for key based authentication then u have to prepare setup according to that and proceed the login procedure.If the key based authentication fails it automatically asks for password means it automatically switches to password based mode. By the way if u want to verify u can use this on linux :

"ssh -v user@IP " It will show u all the debug messages , and if the authentication is passed u will be logged in otherwise u will get "Permission denied". Hope this will help u.

Upvotes: -1

Steven Kryskalla
Steven Kryskalla

Reputation: 14649

Most servers have curl and scp installed, which you can use to log into an SFTP server. To test if your credentials work using curl, you could do this:

$ curl -u username sftp://example.org/
Enter host password for user 'username':

Enter your password and if it works you'll get a listing of files (like ls -al), if it doesn't work you'll get an error like this:

curl: (67) Authentication failure

You could also try using scp:

$ scp [email protected]:testing .
Password:
scp: testing: No such file or directory

This verifies that you that you were able to log in, but it couldn't find the testing file. If you weren't able to log in you'd get a message like this:

Permission denied, please try again.
Received disconnect from example.org: 2: ...error message...

Upvotes: 19

anschauung
anschauung

Reputation: 3768

Try logging in.

Not being snarky -- that really is probably the simplest way. By 'verify[ing] that SFTP access has been granted," what you're really doing is checking is a particular l/p pair is recognized by the server.

Upvotes: 3

Rob Wells
Rob Wells

Reputation: 37103

G'day,

What about telnet on to port 115 (if we're talking Simple FTP) and see what happens when you connect. If you don't get refused try sending a USER command, then a PASS command, and then a QUIT command.

HTH

cheers,

Upvotes: 0

Related Questions