28 November, 2010

How to share /home directory between two linux installations

            Frequent re-installations of operating system due to crashes  is always been a problem for many of the linux users, and my case is also the same.... Everytime i start with doing something like trying some new commands or editing some configuration files and finally ends up with an 'OS crash' and a fresh installation thereafter. Now it's been a very usual matter that i may have to install a fresh copy of linux distro probably once in a month. Sometimes the crash may occur due to installation of a new theme (last week editing some theme files manually after it's installation made my 10.04box stand on nails...), sometimes the crash may be the by-product of installation of an incompatible version of application etc...

While fighting with all these crashes and re-installations the major problem is related to backing up of the data and personal files stored in the /home folder. Usually the contents of the /home contains files and directories including apache's root directory, downloads, files received over bluetooth, joomla/html/php projects etc. So it's very important to back up data all the time Ubuntu is reinstalled.

Solution

One of the best solution to avoid this kind of frequent backup-restore problem is separate the /home directory from the root directory during the installation. The advantages of this separation comes in two ways

1. When a crash occurs to the OS the /home directory remains intact because it is a separate disk partition. So on reinstalling after the crash we can map the old /home partition of the crashed one as the /home of the new linux. This makes it possible to access the files as if before the crash occured.

2. It's easy to share the /home folder between any no of linux distributions installed parellely on your machine. During installation of each of the distro, we can select the partition to be shared as its /home. Better keep the filesystem type (eg:- ext4) same while selecting the /home of other distro as it's new /home. This can be useful even with linux distributions of different architecture using similar filesystem types(Ubuntu and fedora can share a common /home if the /home is mounted as ext4).

On the ground...


Select the manual partitioning options


Setting up the root partition 


Selecting the /home partition of the previously crashed or parellelly installed linux.


 
Mounting the /home partition of old linux as /home of new linux. Don't check the format box. If mistaken you may lose all the data due to disk format
Read rest of entry

07 September, 2010

Remote login using SSH and copying files from remote machines


copy files remotely over internt

SSH stands for “secure shell” and its a program and protocol also. Through SSH you can  use the applications that are available in a remote computer on internet even if you don't have it in local machine. Only requirement is a working internet connection and an account in the remote machine.  The OpenSSH program suite, developed by the OpenBSD project, offers a free SSH facility with everything necessary to use encrypted connections on different operating systems: 
  :: commandline tools for working on remote machines
  :: to execute programs remotely 
  :: to tunnel Internet services via SSH 
  :: tools for secure file copying

   OpenSSH is a must-have application in any recent Linux distribution. Most systems offer separate packages for the client and the server. Server program is necessary if you want to access your Linux computer via SSH from another machine. 

Applications . . .
- You can login to your office computer remotely from
   home and do all the office work @ home
- Using ssh tunnelling you can communicate over the
   restrictions imposed by proxies and firewalls 
Functions of SSH

ssh       :The command-line client establishes   
             encrypted connections to remote machines 
             and will run commands on these machines if
             needed.

scp      :To copy files (non-interactively) locally to or 
             from remote computers, you can use scp
             (“secure copy”).

sftp      :The ftp client (“secure ftp”) supports
             interactive copying. Like other command line
             ftp clients, the tool offers many other options
             such as copying, changing and listing 
             directories, modifying permissions, deleting
             directories and files, and more...

sshd     :The SSH server is implemented as a daemon
             and listens on port 22 by default. SSH clients 
             establish connections to the sshd.

Installation & Configuration

Take the terminal and type in following commands to install SSH

$ sudo apt-get install openssh-server openssh-client
 
Inorder to test ssh please type in the following command...

$ ssh localhost 
 
To stop ssh server, type in

$ sudo /etc/init.d/ssh stop

To start sshs server, type in

$ sudo /etc/init.d/ssh start

To restart ssh server, type in

 # sudo /etc/init.d/ssh restart


Remote login using SSH

You can remotely login to another machine on the internet by using the following command,

$ ssh  -X  username@100.100.100.3

Replace the username and ip (100.100.100.3) with the one corresponding to you. X option enables the Xserver.

                On executing the above command, the terminal prompt changes to user@remotemachine:~$  you can execute any command as if you are logged in at the remotemachine. Any application from that remote machines can be run by executing the command

examples :
user@remotemachine:~$ firefox
          for starting firefox on a remote machine
user@remotemachine:~$ nautilus
          for starting the file manager on remote  
           machine 
user@remotemachine:~$gnome-session
          to start the gnome session so that you get the   
          desktop with all the features, then you can 
          perform everything in graphical user 
          environment  


Copying files from remote system

                The ssh command alone allows remote login only, but you can copy a file in a remote system to your local machine using the 'scp' command.

1. You are already logged in at user@local$

2. Login to the remote machine  using the ssh  
    command. Then the terminal prompt will change to 
    user@remote

3. Type in the scp command as follows

$ scp  filename user@ip_local:destination

               filename      :: the file to be copied which is 
                                      in remote machine
               ip_local        :: ip adress of your machine
               destination  :: destination folder where the 
                                     copied files are to be saved
       Then the terminal will prompt for your accounts password...


Thats all for now with ssh and scp. You can refer the man page of ssh and scp to see more details in case of using them under a proxy server and also for advanced features...






Read rest of entry

24 April, 2010

How to connect Windows XP to Ubuntu over LAN cable

                 This post is all about connecting Ubuntu and Windows system using a LAN cable for sharing data between them . . . A LAN cable is a preferable mechanism for sharing files in a good speed in the range of Mbps.

Connection requirements :
        LAN cable
        Ubuntu linux with Samba (or any other file sharing application)
        Windows machine

Connect LAN cable to both of the systems. On connecting both the Windows and Ubuntu try to connect automatically between each other.

Now follow the steps below... 

Configuring the Linux system


1.  Right click on the Network manager icon on the top sidebar. Select 
     "Edit  connections".

2.  Under the "wired" tab on the pop up Network connections window choose the
     "add" button to add a new connection.

3.  Make changes in the opened window as in figure

        # specify the connection name as u like. I call it "Ubuntu XP network"
        # Check the connect automatically box enabled
        # Click on the IPv4 settings
            * Click on the methode field and choose "Manual"
            * Click below the address feild and enter an arbitray ip say, 
               192.100.100.1                   ....you can choose it your own
            * Add 255.255.255.0 in the Netmask (no options for you, enter it as if)
        # click on the apply button to make the changes available.



4. That's all you need to do in Ubuntu machine.


Configuring the Windows system

1.  Open the Network Connections folder from Start ---> Network Connections

2.  Right click on the connection with the name "Local Area Connection" and 
     click on the properties


3.  Under the general tab select Internet Protocol(TCP/IP) and click 
     "properties"


4.  Choose 'Use the following IP address' and enter
        IP Address  :  192.100.100.3
        Subnet Mask :  255.255.255.0




5.  Press the OK button to complete the configuring.

            Thats all about configuration. Now restart the connection from the Ubuntu system using network manager (No need to pull out the cable physically)
Inorder to share a particular file from windows, right click on the file and select properties.In the properties window check the corresponding
feilds related to sharing under the "sharing" tab.

To access those files from Ubuntu system, goto Places ---> Network ---> Windows network
Read rest of entry
 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger