瀏覽代碼

provision.pl: added check for root user. added author header

tags/release-00
gashapwn 3 年之前
父節點
當前提交
39b5e46b02
共有 1 個檔案被更改,包括 16 行新增0 行删除
  1. +16
    -0
      perl-script/provision.pl

+ 16
- 0
perl-script/provision.pl 查看文件

@@ -3,11 +3,27 @@
use warnings;
use strict;

# provision.pl
# script to provision a tilde instance
#
# This script is intended to be run on a fresh
# OpenBSD install
#
# gashapwn
# Nov 2020


my $pwuid;
my $admin_un;


# Make sure we're running as root
$pwuid = getpwuid( $< );

if($pwuid ne "root"){
die "script must be run as root";
}

# Check /etc/passwd for the username created during
# installation
if( ($admin_un) = `tail /etc/passwd | grep -v "nobody:"` =~ /([^:]+):[^:]+:[0-9]{4,}/){


Loading…
取消
儲存