Category Archives: Scripting

Sysinfo like on Linux

This shows loads of information like Sysinfo in Windows

 

recap utility

 

Bash log redirect / stdout and stderr

 

ftp/sftp – vsftpd

 

One liners to automatic creation of username and passwords

Automatic creation of users/passwords (FTP)

Manually create list.txt with user:doc_root
e.g.:

Get commands to create FTP users

 

Get commands to set FTP permissions (if doc_root exists already)

 

Generate and Assign random passwords to the users.

 


Create a list of vhosts’ paths: vhosts.txt

Example with only .com domains:
/var/www/domain1.com
/var/www/domain2.com
/var/www/domain3.com

Use a regex for sed to extract the vhost name, removing dots (example based on the example above)
This will return a list of PATH and VHOSTNAME. We will use VHOSTNAME as USER for that path

 

Print out the commands to run to add FTP users (no SSH)
Once checked the output, run these lines

(for sftp only):

 

This will print out commands to run to assign user:apache_group to the vhosts’ paths

(for sftp only):

 

Set g+s on vhosts to preserve directory owner
[TO CHECK]

[THIS EXECUTE]

 

Create list of random passwords using pwgen

 

Create list of random passwords using openssl

 

Apply these passwords automatically

 

Print output for reference

Space utilised one liners

 

Apparent size is the number of bytes your applications think are in the file. It’s the amount of data that would be transferred over the network (not counting protocol headers) if you decided to send the file over FTP or HTTP. It’s also the result of cat theFile | wc -c, and the amount of address space that the file would take up if you loaded the whole thing using mmap.

Disk usage is the amount of space that can’t be used for something else because your file is occupying that space.

In most cases, the apparent size is smaller than the disk usage because the disk usage counts the full size of the last (partial) block of the file, and apparent size only counts the data that’s in that last block. However, apparent size is larger when you have a sparse file (sparse files are created when you seek somewhere past the end of the file, and then write something there — the OS doesn’t bother to create lots of blocks filled with zeros — it only creates a block for the part of the file you decided to write to).

Source (clarification): http://stackoverflow.com/questions/5694741/why-is-the-output-of-du-often-so-different-from-du-b 

Holland backup setup

>> package:

>> Auto install script:

>> Where is the DB conf file:

>> When it runs

>> Test command to see if all works without actually run it

>> /etc/holland/backupsets/default.conf