# flags source code as UTF8
use utf8;
# flags STDOUT as UTF8
binmode(STDOUT, ":encoding(utf-8)");
2012/10/31
2012/10/23
Stop "sshd" in Ubuntu
Internet says this one works:
sudo update-rc.d -f sshd remove
but it isn't.
It does NOT work.
The following works:
sudo apt-get remove openssh-server
sudo update-rc.d -f sshd remove
but it isn't.
It does NOT work.
The following works:
sudo apt-get remove openssh-server
2012/10/18
Real UID vs Effective UID
If you think about a large company where employees have different levels
of access to different locations, you could compare the Real User ID
to the name badges people wear, and the Effective User ID to the set of
keys they've been given.
2012/10/12
Perl - read in a whole file at once
use Perl6::Slurp;
my $data = slurp 'path/to/file';
OR
use File::Slurp;
my $text = read_file( 'filename' );
my $lines = read_file( 'filename', array_ref => 1 );
my $lines = read_file( 'filename', array_ref => 1, chomp => 1 );
OR
use File::Slurper;
OR
my $body = do { local( @ARGV, $/ ) = $filename; <> };
OR (if the file is under __DATA__)
my $body = join( '', <DATA> );
my $data = slurp 'path/to/file';
OR
use File::Slurp;
my $text = read_file( 'filename' );
my $lines = read_file( 'filename', array_ref => 1 );
my $lines = read_file( 'filename', array_ref => 1, chomp => 1 );
OR
use File::Slurper;
OR
my $body = do { local( @ARGV, $/ ) = $filename; <> };
OR (if the file is under __DATA__)
my $body = join( '', <DATA> );
Permissions
(not optimised for performance, but does the job):
find . -name '.svn' -prune -o -type d -exec chown www-data:www-data {} \;
-exec chmod 700 {} \; -o -type f -exec chown www-data:www-data {} \; -exec chmod 600 {} \;
find . -name '.svn' -prune -o -type d -exec chown www-data:www-data {} \;
-exec chmod 700 {} \; -o -type f -exec chown www-data:www-data {} \; -exec chmod 600 {} \;
List all users
List all users:
awk -F: '{ print $1 }' /etc/passwd
List all members of a group:
awk -F: '/^groupname/ {print $4;}' /etc/group
awk -F: '{ print $1 }' /etc/passwd
List all members of a group:
awk -F: '/^groupname/ {print $4;}' /etc/group
Subscribe to:
Posts (Atom)