Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Thursday, May 1, 2008

find

One thing about sharing files between Windows and Mac via a USB is that the USB has to be formated in fat32. Then all the files copied from Windows will have the file mode x enabled. Manually removing it for each file is very cumbersome because for directories you do want to keep the x mode. This can be done easily using find
# find . ! -type d -exec chmod -x {} \;
Another example is
# find . ! -type d -exec xattr -d com.apple.quarantine {} \;

Friday, April 18, 2008

Tips on ssh

1. Use ssh-keygen to generate key pairs
# ssh-keygen -t rsa -b 2048
ssh-keygen can generate both RSA and DSA keys. While you can specify any key length for RSA keys (in the example it is set to 2048 bits), the key length for DSA is always 1024 bits as required by the government. RSA is also faster when it comes to verify the key.

After ssh-keygen generates the key pair, put id_rsa.pub to ~/.ssh/ on the remote machine and rename it to authorized_keys.

Now enjoy remote login without having to input your password. (Of course you have to make sure the physical access to your machine is secured.)

2. Use ssh_config to specify ssh setting

You can put the configuration into the file ~/.ssh/config. Below is an example
Host short
HostName long.server.name
User name
Then you only need input
# ssh short
instead of
# ssh name@long.server.name
For more options, man ssh_config.