Archive for March, 2013
Windows 8 x86 no network connection on VMware Workstation 9
Posted by MB in Uncategorized on March 26, 2013
On creating a Windows 8 virtual machine in VMware Workstation 9, the virtual machine will not be able to access the network.
If you go into device manager, the network adapter will be listed with no drivers installed.
To remedy this, edit the .vmx file, and add the following line:
ethernet0.virtualDev = "e1000e"
This solution is from VMware communities – Windows 8 RC internet connection.
Simple bash script to copy files via SCP
Posted by MB in Uncategorized on March 16, 2013
This can be used for example to retrieve a copy of one’s website, blog, or other files on a script or cron job. You will need to have your SSH identity files for passwordless login.
#!/bin/bash #-- start config # Local Directory for backups. A date-specific folder is created under this directory for the files. LD=~/website_files/backups # Remote Directory to retrieve. Files are retrieved recursively starting here. Hidden files are included. # Must be full path, don't use ~ shortcut. RD=/home/www # Path to SSH ID file (private key) ID=~/.ssh/id_rsa # USERname to login as USER=username # HOST to login to HOST=example.com #--- end config BD="$LD/`date +%F`" mkdir $BD scp -ri $ID $USER@$HOST:$RD/. $BD
Enjoy!
Create SSH identity files for passwordless login
Posted by MB in Uncategorized on March 16, 2013
The SSH command-line program supports the use of identify files (via the -i
parameter) to use certificate-based login. This is useful if you want to bypass the manual entry of passwords, or script an SSH or scp task.
Generating the identity files is relatively quick and easy.
First, lets assume there are two Linux systems, the local system (where the SSH connection originates), and the remote system (where the connection is being made to).
On the local system, run ssh-keygen
ssh-keygen
You can accept the default location of the keyfiles (~/.ssh), and press enter twice to generate the keyfiles with no password.
Now, in your destination directory you will have two files, id_rsa and id_rsa.pub. The file with the .pub extension is the public keyfile, while the other is the private one.
For security, chmod the .ssh directory to 0700.
chmod 0700 ~/.ssh
Transfer the public keyfile to your target system.
on your target system, create ~/.ssh directory with 0700 mode.
mkdir ~/.ssh chmod 0700 ~/.ssh
rename the id_rsa file to authorized_keys and place it in ~/.ssh
You can now try to ssh into the target system by specifying the -i
paremeter with the private keyfile.
Enjoy!
Further reading:
Quick sh script cronjob to fix user homes permissions on Synology
Posted by MB in Uncategorized on March 2, 2013
If you have a Synology where multiple users access files, but frequently moves files around as the admin user, you’ve no doubt noticed that permissions can frequently get messed up, where regular users won’t be able to delete files created by the admin user, and so on. This can be especially prevalent when using the “user homes” feature.
(UPDATE: A reader has shared a new approach, please find it here: ACL fix for Synology DiskStations)
You could use file manager as the admin user to fix permissions by hand, but there’s an easier way.
This quick little script, when run as a cron task, will traverse the user home directories, resetting permissions automatically. It’s especially handy.This only acts on user home directories, and not any other shares.
This was done on a DS211j running DSM-4.2 BETA.
So, here’s the script:
HOMES="/volume1/homes" cd $HOMES for x in *; do chown -R $x $x; done
Change HOMES to reflect where your user home is.
So, first go in and upload it somewhere on your DiskStation where you like it. In this case, I’m uploading it to admin’s user home.
Now, right-click on it and select Properties, and set it as follows (that’s chmod 0700
for those of you paying attention)
Now, to simply set it as a scheduled task. Open Control Panel > Task Scheduler and click Create > User Defined Script.
Set up the task as follows:
Under the general tab, use something descriptive for the task name, and run as root. Make sure enabled is checked.
Enter the full path to your script (the provided is typical, but yours may differ — use SSH to help you locate the file if unsure)
For the schedule tab:
I have mine set to run hourly. Granted, I don’t update my files that often, but it helps to make sure permissions are set correctly and make sure they’re never wrong for very long.
And then click Ok. This should show:
And that’s it. Your home permissions will be fixed automatically from now on.
Questions, comments, or feedback on the above? Please leave it in the comment section below. Thank you!