Note: The instructions that follow are for a Linux based laptop and a Windows 7 main, but it is possible to do the same things with any combination of operating systems.
Note: If you are interesting in doing anything that is mentioned here but find the instructions too advanced for you please leave a comment and I can explain in more detail.
Note: Many of the solutions need a restart before they will take effect.
Note: I am not even close to a expert in Linux, so if you know any better ways of doing what I am doing then please share your opinion.
What I have done:
- Setup a custom script folder on the laptop to allow easy executing of your scripts (needed to make the completed system easy to execute/automate)
- Mount main computers shares onto laptop with read and write access
- Sync important folders between laptop and main
- Remotely turn on main computer from laptop on same network (wake on lan)
- Remotely turn off main computer from laptop on same network
Setup Custom Script Folder
If you have custom scripts that you have created or discovered and you want to run them from anywhere in the terminal (just like the built in commands) then you have to add the path of your custom script folder to your PATH variable.
To do this edit ~/.bash_profile and add the line PATH=$PATH:(custom scripts) replacing (custom scripts) with the folder you created (I used $HOME/bin).
This will work for all normal script executions, but will encounter problems with use with the sudo command on some Linux systems (including Ubuntu), as sudo changes the PATH variable in some Linux distros. To fix this edit ~/.bashrc and add the command alias sudo='sudo env PATH=$PATH' .
Example of Use:
1. ~/bin has been added to your PATH as show in previous instructions
2. HelloWorld.sh has been added to the ~/bin folder
3. Now from anywhere in the terminal the HelloWorld script can be run by typing HelloWorld.sh
Mount Main Computer Shares with Read and Write Access
Windows Desktop Steps:
Right click My Computer - Management - Shared Folders - Shares - RC New Share...
Input what you want to share - Enter the share name - I suggest using “Administrators have full access; other users have read-only access”(you need some users with full access)
Linux Laptop Steps:
Install Samba so that you can work with windows shares.
To mount share use: mount -t smbfs -o username=(desktop username with correct permissions),password=(password for specified user),uid=(laptop user that you want to have permission to use the files shared) //(desktop name)/(share name) (mount location)
Sync Folders Between Laptop and Main
I have files that I want to be able to access on both my desktop and my laptop, regardless of where I am and if I am connected to my lan or the internet, and these files are constantly changing. So the only real solution is to have a program sync these folders between my two computers. Since I want to be able to update the files from both my laptop and desktop I want a two way sync, unfortunately the program that seems the best for this on first glance unison did not work for no apparent reason; So I used grsync, a GUI for rsync, and I am glad I did as it seems to have far more options and works quite well.
To start first install grsync (you could of course use the non GUI version, but if you that hard core you probably would not be reading this). Then create two new sessions for all folders you want to sync (one for each direction).
Note: Depending on how much data you have to transfer, the first run could take a long time.
Note: You will need read/write access to both folders for the sync to complete successfully.
Wake On LAN
The desktop, of course, needs to be on to access its shares; And who wants to actually go and turn them on personally? Well their is no need because computers and network adaptors have be designed for a long time now with the functionality to turn themselves on when certain packets are sent to them.
Windows Desktop Setup:
Lan Adaptor properties - Configure - Advanced (for older machines) OR Power Management (on my machine) - Enable wake-on-lan and special packet only.
Restart computer and go into the bios - Under Power Management (or other depending on version) enable wake from S5, or other similar title (S5 means shutdown but plugged into wall).
Linux Laptop Setup:
install the command line utility wakeonlan.
To start up computer use: wakeonlan (mac address of desktop) OR wakeonlan -i (IP address of desktop) to start up computer.
If you are able to turn on your computer remotely then why not be able to turn it off remotely?
Windows Desktop Setup:
To allow remote shutdown edit: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Create or edit the 32-bit DWORD LocalAccountTokenFilterPolicy to hold the value 1, deleting this entry or making it equal to 0 will reverse the effect.
Note: this apparently will make your computer less secure.
To shutdown the desktop use: net rpc shutdown -f -I (IP address of desktop) -U (desktop username)%(password for specified user)