Always Geeky

Knowledge base for various geeky topics
 

+menu-

Linux

Copying Linux encrypted shadow password

If you need to copy a Linux user account from one system to another and need to presever the password without knowing it, you can use this process.

First, create the user:


sudo useradd bob

Set group membership as required, such as appending the wheel group:


sudo usermod -a -G...Read More »

apt-get error: Ignoring Provides line with DepCompareOp for package

Receiving the following error, includes the message that running “apt-get update” should fix it. It doesn’t, as that command generates the same error.

W: Ignoring Provides line with DepCompareOp for package libjpeg62 8,790 kB/s 0s
W: Ignoring Provides line with DepCompareOp for package php-psr-http-message-implementation
W: Ignoring Provides line with DepCompareOp...Read More »


Using rsync to ensure 2 directories match

rsync -nrhc --progress /home/user/source/docs/ /home/user/destination/docs/

If you think ‘destination’ includes everything in ‘source’, but want to check, the above command will tell you if this is the case. Here are the options broken down:

-n
This is important, it tells rsync to do a dry-run. Without this option, it will actually copy...Read More »


How to generate a pre shared key using APG

A common requirement is to generate a random, unique and secure pre-shared key, typically for use in VPN’s. The Linux tool, APG (Automated Password Generator), is a great tool for this job, but you need to specify a few options to get the correct output.

If you just run ‘apg’, you...Read More »


TCP dump without truncating

If you receive the following error while performing a packet capture with tcpdump, there is a solution.

    Packet size limited during capture

Simply run tcpdump with the “-s 0” flag, and this will capture the entire packet. For example:

    sudo tcpdump -i any -w capture.pcap...Read More »

Useful openssl commands

View certificate attributes, such as common name (domain name), subject alternate name, issued by, expiry date, issued to, etc.

openssl x509 -in cert.crt -noout -text

Check certificate and key match (no output indicates a match):

diff < (openssl x509 -in certificate.crt -noout -modulus) <(openssl rsa -in privatekey.key -noout -modulus)

Manually check certificate and key...Read More »


curl with multiple HTTP headers

If you need to set multiple HTTP headers when using curl, you cannot do so by delimiting them with a CRLF or similar line break. Doing so won’t work. You must set each header within a distinct -H parameter.

The correct method:

$ curl -I https://alwaysgeeky.com -H "Host:alwaysgeeky.com" -H "cache-control:no-cache"

Results:
HTTP/1.1 200...Read More »


 

Leave a Reply