Wednesday, December 10, 2014

This technique will require the use of the live cd, and a usb stick, as a vessel for the persistent file. Two requirements: the partition of the live cd must be in a format that can be mounted automatically, for example: vfat, ext3 or ext4 and the loopback file must be in the root of the partition

To set your live cd to use the loopback file, after your live cd booted up, add a space followed by word "persistent" without the quotes, at the end of your kernel parameter. This can be achieved in linux mint by pressing tab in the kernel list menu, add the parameter, and enter to boot from that kernel.

For ubuntu, when the Live CD menu gets displayed
hit the key to enter “Other Options”. This will display the
arguments that the Live CD passes to the kernel. At the end of this
argument list just add a space and add the word "persistent". This will
instruct the Live CD to maintain and use persistence.

That's all folks, test your persistent live cd by saving a few files in your home, and restart to see whether the files survived a reboot.

Thursday, November 13, 2014

Ssh keys are used to login into linux server securely, and it is more secure than using password. To use it, just put the public key in the server that you want to access to, and connect to that server using a machine that has your private key. To increase the security even more, you can even set passphrase for the private key during the generation process. To generate the keys:

To generate the rsa key in the client machine (usually it is your own machine), run below command:

For the location to save key, you can press Enter to save to the default location, which is /home/foo/.ssh where foo is the user we use to generate the key. id_rsa is your private key, and id_rsa.pub is your public key

$ ls .ssh/

id_rsa id_rsa.pub

For the passphrase, you can opt to omit it, but it will reduce the security level of the key pair, since anyone who get your private key can use it to access all the servers that contain your private key. The advantage is, you can do passwordless access.

The final thing to do is to copy the public key to the servers that you want to access, and you are done.

Friday, October 10, 2014

Have you been in the situation where you want to transfer a big file, and decided to tar it before transferring but being limited by the disk space available on the machine?

Well, worry no more as I will show you how you can do a tar on the fly while ssh'ing, to overcome that limitation.

Method 1:

ssh foo@machine-to-keep-the-data "tar czpf - /data/to/be/transferred" | tar xzpf - -C /the/data/new/place
What this command will do is to create a tar file (tar czpf), and untar it at the other side of the ssh (tar xvpf) command, where c is for create tar, z is to use gzip, p is for preserving permission, f is for file which is to be zipped, - is for stdin or stdout and x is for extract

Method 2:

tar cpf - /data/to/be/transferred | ssh foo@machine-to-keep-the-data tar xpf - -C /the/data/new/place"
This command will tar the file, and untar it at the other end, same as above, but just different command arrangement

Method 3 (this is useful if you want to tar it. and keep it that way on the other end, without untarring it):

Install teamviewer, but it will failed, because of unmet dependencies:$ sudo dpkg -i teamviewer_linux.debReading package lists... Done...The following packages have unmet dependencies: libc6 : Breaks: libc6:i386 (!= 2.19-0ubuntu6) but 2.19-0ubuntu6.3 is to be installed libc6:i386 : Breaks: libc6 (!= 2.19-0ubuntu6.3) but 2.19-0ubuntu6 is to be installed libc6-dbg : Depends: libc6 (= 2.19-0ubuntu6.3) but 2.19-0ubuntu6 is to be installed libc6-dev : Depends: libc6 (= 2.19-0ubuntu6.3) but 2.19-0ubuntu6 is to be installed teamviewer9:i386 : Depends: libasound2:i386 but it is not going to be installed Depends: libfreetype6:i386 but it is not going to be installed Depends: zlib1g:i386 but it is not going to be installed Depends: libsm6:i386 but it is not going to be installed Depends: libxdamage1:i386 but it is not going to be installed Depends: libxext6:i386 but it is not going to be installed Depends: libxfixes3:i386 but it is not going to be installed Depends: libxrandr2:i386 but it is not going to be installed Depends: libxrender1:i386 but it is not going to be installed Depends: libxtst6:i386 but it is not going to be installedE: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Thursday, July 10, 2014

This is useful when, you have a server that is authenticated by ldap. After you have edited something in your ldap server, let's say you have edited a gid for a user, you would find out that it won't be reflected immediately on the client side. So in this case, how would you force your client to accept your newly changed settings? The answer is you need to restart nscd (name service cache daemon):

2nd column is Number of links (2,1), the number of names there are for the file. Generally
an ordinary file will only have one link, but a directory will have
more, because you can refer to it as ``dirname'', ``dirname/.'' where
the dot means ``current directory'', and if it has a subdirectory
named ``subdir'', ``dirname/subdir/..'' (the ``..'' means ``parent
directory'').