Tuesday, January 20, 2015

SFTP Issue.

Hi Friends,

I wants to user SFTP (port 22) for the FTP Purpose however at the same
time we need to make sure that user will not not able to take ssh
connection on server(putty, cmd etc.) and logs should also get trigger
for SFTP.

It's quite urgent, we have one of the show-stopper  issue occurred due
to this, Please revert as earliest.

vishal karande karande.vishal23@gmail.com


Multazim Deshmukh multazim.deshmukh0786@gmail.com


No Luck, User not able to do the sftp with provided shell .

Hi Multazim,

I have tried this earlier but it's giving error while restarting the
ssh service.

[root@localhost ~]# service sshd restart
Stopping sshd:                                             [FAILED]
Starting sshd: /etc/ssh/sshd_config: line 123: Bad configuration option: Match
/etc/ssh/sshd_config: line 124: Bad configuration option: ChrootDirectory
/etc/ssh/sshd_config: line 125: Bad configuration option: ForceCommand
/etc/ssh/sshd_config: terminating, 3 bad configuration options
                                                           [FAILED]
[root@localhost ~]# date
Thu Nov 27 00:13:00 PST 2014
[root@localhost ~]#

###########################################################################

Please find /etc/passwd and sshd_config file conf for reference.

vishal:x:500:500:RHEL_5_TEST_VM:/home/vishal:/bin/bash
#test:x:501:501::/home/test:/sbin/nologin
test:x:501:501::/home/test:/usr/libexec/openssh/sftp-server
ftptest:x:502:502::/home/ftptest:/usr/sbin/nologin
guestuser:x:503:503::/incoming:/sbin/nologin

###################################################################

# override default of no subsystems
#Subsystem      sftp    /usr/libexec/openssh/sftp-server
Subsystem       sftp    internal-sftp
#Subsystem    sftp    /usr/libexec/openssh/sftp-server -f LOCAL5 -l INFO
#Subsystem       sftp    /usr/libexec/openssh/sftp-server -l INFO -f AUTH

Match Group sftpusers
        ChrootDirectory /sftp/%u
        ForceCommand internal-sftp

#sftp logging
#local5.*                        /var/log/sftpd.log
[root@localhost ~]# date
Thu Nov 27 00:16:13 PST 2014
[root@localhost ~]#
####################################################################



vishal karande karande.vishal23@gmail.com



These commands for SFTP chroot is supported in OpenSSH 4.9p1 & higher versions.
Please check your openssh version and upgrade it to higher version.
Let me know the outcome.

No comments:

Post a Comment