[scponly] Script to create jailed scp user

Nick Anderson nick at anders0n.net
Mon Aug 15 12:03:08 EDT 2005


Actually I finally found it. I was using the wrong path to scponlyc its in 
sbin not bin, so i was setting a shell that didnt exist.

So if anyone wants to use this script feel free. it runs on freebsd 5.3, im 
sure it will run on other systems with minimal changes.

I would reccomend adding $shell_path=system("which scponlyc"); at the top and 
changing the command that creates the user to 
system("pw useradd $username -d /home/scponly//home/$username -s 
$shell_path/scponlyc -m");

thanks 

> > <script>
> > #!/usr/bin/perl
> > use Expect;
> >
> >
> > $username=$ARGV[0];
> > print "Creating $username remote backup account\n";
> >
> > #generte password for user with apg
> >
> > $password=`apg -n 1 -x 4 -m 4`;
> > chomp($password);
> > print "New Password for user is $password\n";
> >
> > #create jailed user for scponl
> > system("pw useradd $username -d /home/scponly//home/$username
> > -s /usr/local/bin/scponlyc -m");
> >
> > $change_pass = Expect->spawn("passwd $username");
> >
> > unless ($change_pass->expect(10, "Password")) {
> > }
> >
> > print $change_pass "$password\r";
> > unless ($change_pass->expect(10, "Password")) {
> > }
> > print $change_pass "$password\r";
> > $change_pass->soft_close();
> > <script>
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > scponly mailing list
> > scponly at lists.ccs.neu.edu
> > https://lists.ccs.neu.edu/bin/listinfo/scponly

-- 
Must I hold a candle to my shames?
		-- William Shakespeare, "The Merchant of Venice"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : https://lists.ccs.neu.edu/pipermail/scponly/attachments/20050815/0921784c/attachment.bin


More information about the scponly mailing list