[scponly] Script to create jailed scp user

Nick Anderson nick at anders0n.net
Sat Aug 13 13:01:57 EDT 2005


Ive been working on a script to create a user that is jailed and has scponly 
acces and the password is randomly generated and set. Now the problem with 
the scritp seems to be that if i use scponlyc i cant authenticate but if i 
set the users shell to anything else say bash or just normal scponly it works 
just fine.


can anyone tell m what needs to be done with this perl script to make it work?
there are some extra flags sent to apg atm just for a shorter password for 
testing ... easier to type than an 8 char random passwod
Im not approved for the list yet so please email me directly if you have any 
suggestions nick at anders0n.net
<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>
-- 
Coincidences are spiritual puns.
		-- G.K. Chesterton
-------------- 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/20050813/4ef82909/attachment.bin


More information about the scponly mailing list