From 084fe5456637f17a698dc29c408df31758356a90 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 6 Jul 2020 17:00:42 +0200 Subject: Trying git shell cmd --- gitjoe-newuser.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gitjoe-newuser.pl') diff --git a/gitjoe-newuser.pl b/gitjoe-newuser.pl index 471dd94..0a6a0e8 100755 --- a/gitjoe-newuser.pl +++ b/gitjoe-newuser.pl @@ -6,15 +6,16 @@ use Term::ANSIColor; sub main { my $argc = $#ARGV + 1; - if ($argc < 2) { + if ($argc < 3) { print colored("Failed!\n", 'bold red') . "Missing argument, 2 needed " - . colored("[user - password]", 'bold') + . colored("[user - password - ssh public key]", 'bold') . "\n"; exit 1; } my $usr = $ARGV[0]; my $pass = $ARGV[1]; + my $home_dir = '/usr/home/' . $usr . '/'; system( '/usr/local/bin/dash', '-c', @@ -38,6 +39,13 @@ yes no EOF" ); + my $gitshell_cmds = "cd +touch +git +ls"; + open(my $fh, '>:encoding(UTF-8)', $home_dir . 'git-shell-commands'); + print $fh $gitshell_cmds; + close($fh); } main(); -- cgit v1.2.3