As the doctor gone rogue

April 27, 2016

Encrypt a few files or folder on OsX

Filed under: bash, miscellaneous, OsX, SysAdmin — hypotheses @ 4:00 pm

May be you are working on a sensitive data, or just want to secure your personal data on your personal computers. Mac offers the whole hard disk encryption when you install the system, as well as, encryption of your backup through “Time Machine”. However, there are times that you might want to add an extra security to your file. May be you save some of the files to Dropbox or Google Drive, and the file might contain your personal health information that you would not want just anyone to be able to simply read it.

There’s a simple tool in OsX that can help you do this.

zip -e [output.zip] [file-to-be-encrypt]

zip utility will ask you to create a password. The stronger the password. The harder it will be to crack it. However, make sure you will remember the password, too. For this reason, I recommend you to use a password manager, e.g. LastPass is one of an excellent and easy to use tool with several browser integration for both mobile device and personal computer.

Just for the peace of mind. The encryption algorithm in zip might not be very strong. But at least, you save some disk space, and there’s one more extra-security of a password protection that you have to go through before accessing the content of the file.

Advertisements

April 24, 2016

Write a Ubuntu Linux USB boot disk

Filed under: miscellaneous, OsX, SysAdmin, ubuntu — hypotheses @ 8:47 pm

Getting the Linux Image

You’ll get an iso file from your preferred repository. Following the link to the Ubuntu mirror at KMUTT in Thailand.
Ubuntu 14.04.4 LTS (Trusty Tahr)
Ubuntu 16.04 LTS Xenial Xerus

Convert iso to img

hdiutil convert -format UDRW -o ubuntu-16.04-server-amd64.img ubuntu-16.04-server-amd64.iso

See man hdiutil for detail about the command

Create a bootable USB drive

  • plug the USB drive into your computer and find out which mount point it is mounted to.
diskutil list

This will show the list of all drives mounted to your system right now. The description of which drive is a UBS drive should be quite clear.
– Unmount the disk before we proceed to write a bootable image on it.

# unmount it
diskutil unmount /dev/disk2
  • copy the disk image to your usb drive.
sudo dd if=ubuntu-16.04-server-amd64.img.dmg of=/dev/rdisk2 bs=1m

With /dev/rdisk2 instead of /dev/disk2, you are writing the raw data to the USB drive which will be several folds faster than writing through the buffered /dev/disk2 [ref]

Eject the USB drive

  • After writing the image, a diaglog box will alert you that the disk is not readable. Simple eject the disk.
  • Alternatively, at the command diskutil eject /dev/disk2

April 15, 2016

Set sleep time (OsX)

Filed under: OsX, SysAdmin — Tags: , — hypotheses @ 2:10 pm

Find the current sleep time

sudo systemsetup -getcomputersleep

Disable sleep time

sudo systemsetup -setcomputersleep Never

 

Set sleep time to specificN minutes

sudo systemsetup -setcomputersleep 60

This will set the sleep time to  60 minutes.

If you prefer to do this from the GUI, go to System Preference > Energy Saver and choose the desire time to sleep.

 

Create a free website or blog at WordPress.com.