Originally sourced from stack exchange. modified a bit:
https://unix.stackexchange.com/questions/129599/test-tar-file-integrity-in-bash
Modified from the source link above, the following command will iteratively test each .tgz file within the current directory for errors, and if any are detected, will report an error.
$ for i in *.tgz; do echo "Testing $i..."; if tar xOfz $i &> /dev/null; then echo "Error with tarball $i"; fi; done
Options used:
x - Extract from archive
O - Write output to standard out instead of disk
f - Read input from a file
z - Tarball is compressed with Gzip (Some OSes may automatically detect Gzip and not need this option)
&> /dev/null - Redirect both stdout and stderr to /dev/null
Tuesday, September 17, 2019
Misc. Linux Sysadmin tips
Got around to updating the home office machines, and thought it would be a good idea to keep some recurring tips handy:
Disabling SSH login for root user
Disabling SSH login for root user
- Edit /etc/ssh/sshd_config
- Set PermitRootLogin to no (Remove # if present)
- Add AllowUsers
- Save, then restart sshd:
$ service sshd restart
Setup Passwordless SSH:
- Create SSH keypair with options, such as:
$ ssh-keygen -b 5120 - chmod created keypair:
$ chmod 600 - SCP the public key to target machine.
- On target machine:
$ mkdir ~/.ssh$ chmod 700 ~/.ssh - If ~/.ssh/authorized_keys doesn't exist:
move the public key from home folder to ~/.ssh/authorized_keys then
$ chmod 600 ~/.ssh/authorized_keys - If it does exist, then append the public key to the authorized_keys:
$ cat>> ~/.ssh/authorized_keys , then delete the public key. - Test by SSHing to the target machine
Editing Hostnames
- Edit /etc/sysconfig/network. modify HOSTNAME= to FQDN
- Edit /etc/hosts. Add IP address with FQDN and shortname
- Restart network services:
$ /etc/init.d/network restart
Subscribe to:
Posts (Atom)