ciphermethod.com

BASH: createsftpaccount.sh

by on Mar.04, 2009, under Linux, Scripts


#!/bin/sh
#
# Create SFTP user account
#
# 20090304 jah - new
#

if [ "$1" == "" ]
then
  echo
  echo user login to create is blank
  echo use: $0 user
  echo
  exit
fi
 
/usr/sbin/useradd -g sftponly -d /sftpusers/$1 $1
mkdir -p /sftpusers/$1/data
chown root:root /sftpusers/$1
chmod 755 /sftpusers/$1
chown $1:sftponly /sftpusers/$1/data
chmod 700 /sftpusers/$1/data
passwd $1

No comments for this entry yet...

Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

But Wait, There's More!

A few highly recommended friends...