Category ArchiveLinux
Linux &Personal 03 Dec 2008 04:31 pm
LinkStation Pro Duo, enabling SSH
What I did to enable SSH on my LinkStation Pro Duo:
IMPORTANT NOTE: I made a few corrections to the below by adding item 3.6, and updating items 4.4, 5.11, and 5.12. Please read those items over again. If you needed to perform items 5.11 and 5.12 for two PCs, it is important that you use the updated commands.
-
Enable Telnet (temporarily)
- Download the acp-commander
- Run the .jar file by running
java -jar acp_commander.jar -t <IP ADDRESS> -o - Login to your LinkStation Pro Duo using (username and password are found on the above link)
telnet <IP ADDRESS>
-
Enable SSH at Startup
- Create an SSH Startup script by typing
vi /etc/init.d/sshd.sh - Type ‘i’ to enter Interactive Mode (this enables you to type), then proceed to type the following code:
#!/bin/sh
test -f /usr/local/sbin/sshd || exit 0ACTIVE_FILE=/var/run/active_sshdcase "$1" in
start) echo -n "Start services: sshd"
/usr/local/sbin/sshd -f /etc/sshd_config 2>/dev/null &
touch $ACTIVE_FILE
;;
stop) echo -n "Stop services: sshd"
killall sshd
rm -f $ACTIVE_FILE
;;
restart) $0 stop
$0 start
;;
*) echo "Usage: $0 start | stop | restart"
exit 1
;;
esac
exit 0 - Press the ESC key and type “:wq” to Save and Exit
- Make the file executable by running
chmod +x /etc/init.d/sshd.sh - Backup the original script startup file by running
cp /etc/init.d/rcS /etc/init.d/rcS.bak - Modify the rcS file to contain the SSH startup script by typing the following:
vi /etc/init.d/rcS - Press “i” to enter Interactive Mode
- Page Down till you see
echo "** step3 **" - At the end of the next line, add
sshd.sh - Your change should now look similar to the following:
for cmd in diskmon.sh drivecheck.sh ftpd.sh atalk.sh httpd.sh smb.sh clientUtil_servd.sh bonjour.sh lsprcvd.sh daemonwatch.sh logrotate_init.sh cron.sh checkconfig.sh ups.sh pwrmgr.sh sshd.sh - Save your changes and exit by pressing the ESC key and typing
:wq - Add your SSH script to the Daemon Watch, so if it crashes/closes, it will be started again automatically. Run the following code to edit the list
vi /etc/daemonwatch.list - Type “i” to enter Interactive Mode
- Add the following line to the file
/var/run/sshd.pid /var/run/active_sshd /etc/init.d/sshd.sh restart - Save your changes and exit bt pressing the ESC key and typing
:wq
- Create an SSH Startup script by typing
-
Configure SSH
- Backup your original sshd_config file by typing
cp /etc/sshd_config /etc/sshd_config.bak - Modify the sshd_config file by typing
vi /etc/sshd_config - Press “i” to enter Interactive Mode
- Remove the # in front of the following lines (you need to use the backspace key to do this; you may also need to change some of the ‘no’ values to ‘yes’)
Port 22
Protocol 2,1HostKey /etc/ssh_host_key
HostKey /etc/ssh_host_rsa_key
HostKey /etc/ssh_host_dsa_keyPermitRootLogin yes
StrictModes yesRSAAuthentication yes
PubkeyAuthentication yes - Save the file by pressing the ESC key then typing
:wq - Start the SSH Server by running
/etc/init.d/sshd.sh start
- Backup your original sshd_config file by typing
-
Create new Home folders for each user
You will need to do the following for every user you have created!- Create the users via the Web Interface first, once the users are created, start Step 2 for each user
- Create a directory for the user by typing (replace <username> with the actual username)
mkdir /home/<username> - Give the user permission to that folder by typing
chown <username>.<group> /home/<username>
Now this is a bit tricky, depending how you setup the groups. You want to give the permission to a valid user and a group the user is part of. For example, if you have a user named “matt” and a group named “contributor”, then your command would be
chown matt.contributor /home/matt - Finally, make sure the directory has the correct permissions by running the following command
chmod 0755 /home/<username> - Set the user’s home directory by running
usermod -d /home/<username> <username>
-
Create public/private key pairs for each user
You will need to do the following for every user you have created!
I am only going to go over the commands you would use in Linux as I haven’t tried this with PuTTY yet. You will need to do these steps as “each user”. In other words, you will have to logout on your PC, login as the next user and repeat the commands (advanced users can use su <username> to login as an additional user without logging out as their own).- Run the following command in Terminal or Konsole on YOUR PC
ssh-keygen - Leave the file name as “id_rsa”
- If you want a passphrase enter it here, otherwise, leave it blank (I left mine blank)
- Next run the following command to generate a SSH 2 key
ssh-keygen -t dsa - Leave the file name as “id_dsa”
- If you want a passphrase enter it here, otherwise, leave it blank (I left mine blank)
- Next copy the files to your LinkStation by running
scp .ssh/*.pub <username>@<IP ADDRESS>:/home/<username> - Next login to the LinkStation via SSH using
ssh <username>@<IP ADDRESS> - Once login run the following command to create your SSH key directory
mkdir .ssh - Make sure the permissions are set properly by running
chmod 0700 .ssh - Load the public key for SSH 1 by running
cat id_rsa.pub >> .ssh/authorized_keys - Load the public key for SSH 2 by running
cat id_dsa.pub >> .ssh/authorized_keys2 - Make sure the public key entries for SSH have the correct permissions by running
chmod 0600 .ssh/authorized_keys* - Exit out of the LinkStation by typing “exit”
- Try step 8 again and make sure it did not ask for your password this time (if you entered a passphrase, you will be prompted for your passphrase)
- Run the following command in Terminal or Konsole on YOUR PC
Download the sshd_config.zip
Kubuntu &Linux &Ubuntu 17 Aug 2007 07:52 pm
Backup a Hard Drive over the Network
This is a technique I constantly forget when I absolutely need it, and so I am going to post it for future reference as I hate trying to figure out over and over again.
So here is the big secret. First get a Linux distrobution that allows you to use a Live CD. Boot up the computer you wish to backup with the Live CD. While that is happening, get on your primary PC (that is hopefully running Linux) and type the following command and run it:
netcat -l -p 1234 | dd of=backup.img bs=16065b
Once the Live CD is booted, start up the terminal/konsole and run the following (must be ran after the prior command):
sudo dd if=<hard drive partition to backup> bs=16065b | netcat <linux PC's IP Address> 1234
That’s it! It will now backup the hard drive partition you selected on the PC running the Live CD. So easy!
Kubuntu &Linux &Ubuntu 19 Feb 2007 09:49 pm
Disk Full
For anyone who uses Linux, especially Ubuntu or Kubuntu, you will want to read this! I personally hate how Ubuntu and Kubuntu setup my partitions. They typically setup two partitions, the swap, and the rest of the hard drive. I personally prefer to have a partition for the following: / /boot /usr /var /tmp swap.
Now, the reason I hate how Ubuntu and Kubuntu do this, is it is very easy to fill up the entire drive and not know where the bulk of the data is. With separate partitions, when one fills, you know what caused it, or more specifically, what folder is growing too large. I use several development packages and pull down the source to a lot of packages for experimental use, and so a 160 GB drive can fill up fast. With that said, partitioning things out allows me to quickly identify where I need to allocate more storage, and put in a new drive to handle it.
I wish Ubuntu and Kubuntu would allow the Guided Partioning that Debian allows under expert mode to create a multi-partition setup.