scripts and tools to administer the lingy.in public unix / tilde
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

37 satır
734B

  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. # provision.pl
  5. # script to provision a tilde instance
  6. #
  7. # This script is intended to be run on a fresh
  8. # OpenBSD install
  9. #
  10. # gashapwn
  11. # Nov 2020
  12. my $pwuid;
  13. my $admin_un;
  14. # Make sure we're running as root
  15. $pwuid = getpwuid( $< );
  16. if($pwuid ne "root"){
  17. die "script must be run as root";
  18. }
  19. # Check /etc/passwd for the username created during
  20. # installation
  21. if( ($admin_un) = `tail /etc/passwd | grep -v "nobody:"` =~ /([^:\n]+):[^:]+:[0-9]{4,}/){
  22. printf("admin user will be set to %s\n", $admin_un);
  23. }else{
  24. die "create a non-root user & set user passsword before running this script."
  25. }
  26. # grant doas access to admin user
  27. system("echo 'permit $admin_un' > /etc/doas.conf");