aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-06 17:18:14 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-06 17:18:14 +0200
commit8d41c5cdb65031fe368144df2f40d20b8dc15c1b (patch)
tree142d7548f0c459ae4ce3ee94de337e17d1f61f23
parentTrue fix (diff)
downloadjoe-scripts-8d41c5cdb65031fe368144df2f40d20b8dc15c1b.tar.gz
joe-scripts-8d41c5cdb65031fe368144df2f40d20b8dc15c1b.tar.bz2
joe-scripts-8d41c5cdb65031fe368144df2f40d20b8dc15c1b.tar.xz
joe-scripts-8d41c5cdb65031fe368144df2f40d20b8dc15c1b.tar.zst
joe-scripts-8d41c5cdb65031fe368144df2f40d20b8dc15c1b.zip
Newuser update
-rwxr-xr-xgitjoe-newuser.pl28
1 files changed, 21 insertions, 7 deletions
diff --git a/gitjoe-newuser.pl b/gitjoe-newuser.pl
index 7995668..5da9c2b 100755
--- a/gitjoe-newuser.pl
+++ b/gitjoe-newuser.pl
@@ -15,6 +15,7 @@ sub main {
}
my $usr = $ARGV[0];
my $pass = $ARGV[1];
+ my $sshkey = $ARGV[2];
my $home_dir = '/usr/home/' . $usr . '/';
system(
'/usr/local/bin/dash',
@@ -39,20 +40,33 @@ yes
no
EOF"
);
-# my $gitshell_cmds = "cd
-# touch
-# git
-# ls";
-
system(
'/usr/local/bin/dash',
'-c',
- '/bin/mkdir -v ' . $home_dir . 'git-shell-commands'
+ '/bin/mkdir -v ' . $home_dir . '.ssh';
+ );
+ system(
+ '/usr/local/bin/dash',
+ '-c',
+ '/bin/chown -v ' . $usr . ':' . $usr . ' ' . $home_dir . '.ssh';
+ );
+ system(
+ '/usr/local/bin/dash',
+ '-c',
+ '/bin/chmod -v 700 ' . $home_dir . '.ssh/';
+ );
+ open(my $fh, '>:encoding(UTF-8)', $home_dir . '.ssh/authorized_keys');
+ print $fh $sshkey;
+ close($fh);
+ system(
+ '/usr/local/bin/dash',
+ '-c',
+ '/bin/chown -v ' . $usr . ':' . $usr . ' ' . $home_dir . '.ssh/authorized_keys';
);
system(
'/usr/local/bin/dash',
'-c',
- '/bin/ln -v -s /bin/ls ' . $home_dir . 'git-shell-commands/ls'
+ '/bin/chmod -v 600 ' . $home_dir . '.ssh/authorized_keys';
);
}