Jump to content

Main Page/Sfpt user Implementation in Bjp: Difference between revisions

From TetraWiki
Amit (talk | contribs)
Created page with " == '''Implementation of sftp user to upload pdf''' == groupadd sftpusers useradd -s /bin/rbash -d /incoming -g sftpusers pdfupload vim /etc/ssh/sshd_config Thing..."
 
Amit (talk | contribs)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:




groupadd sftpusers
groupadd sftpusers


useradd -s /bin/rbash -d /incoming -g sftpusers pdfupload   
useradd -s /bin/rbash -d /incoming -g sftpusers pdfupload   


vim /etc/ssh/sshd_config
vim /etc/ssh/sshd_config


Things to be implemented :
Things to be implemented :


Hash out this line
Hash out this line
#Subsystem      sftp    /usr/libexec/openssh/sftp-server
#Subsystem      sftp    /usr/libexec/openssh/sftp-server


Subsystem sftp internal-sftp
Subsystem sftp internal-sftp


         Match user pdfupload
         Match user pdfupload
Line 30: Line 30:
  Subsystem sftp internal-sftp
  Subsystem sftp internal-sftp


/etc/init.d/sshd restart
/etc/init.d/sshd restart


AllowUsers pdfupload # Added to get access  
AllowUsers pdfupload # Added to get access  


To provide restricted Entry to sftp user
To provide restricted Entry to sftp user


vim /etc/hosts.allow
vim /etc/hosts.allow
 
sshd: IpAdderes_of_user_to_allow
 
 
 
 
== Implementation of pdf upload procedure ==
 
vim pdfupload.sh
 
#!/bin/bash
 
mv -v /incoming/*.pdf /httpdjail/var/www/cms12/images/pdf_2013/
 
chmod apache.apache /httpdjail/var/www/cms12/images/pdf_2013/*
:wq
 
chmod +x pdfupload.sh
 
crontab -e


sshd: IpAdderes_of_user_to_allow
*/5 * * * * /root/pdfupload.sh > /var/log/pdfupload.log

Latest revision as of 07:27, 8 April 2013


Implementation of sftp user to upload pdf[edit]

groupadd sftpusers
useradd -s /bin/rbash -d /incoming -g sftpusers pdfupload  
vim /etc/ssh/sshd_config

Things to be implemented :

Hash out this line

#Subsystem      sftp    /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
       Match user pdfupload
       ChrootDirectory /%u
       ForceCommand internal-sftp
       AllowTcpForwarding no

Issue[edit]

current version doesn't support Match

Actually Work done

Subsystem sftp internal-sftp
/etc/init.d/sshd restart
AllowUsers pdfupload # Added to get access 

To provide restricted Entry to sftp user

vim /etc/hosts.allow
sshd: IpAdderes_of_user_to_allow



Implementation of pdf upload procedure[edit]

vim pdfupload.sh
#!/bin/bash
mv -v /incoming/*.pdf /httpdjail/var/www/cms12/images/pdf_2013/
chmod apache.apache /httpdjail/var/www/cms12/images/pdf_2013/*

:wq
chmod +x pdfupload.sh
crontab -e
*/5 * * * * /root/pdfupload.sh > /var/log/pdfupload.log