Help - Search - Members - Calendar
Full Version: Networking Linux?
Linuxhelp > Support > Technical Support
Termina
Lets say I have 3 systems I want to have linux on (2 currently have linux).

I'm looking for a way that would allow one of them to be used as a "server", while the other ones get all the programs and whatnot from the main computer. Users would be stored on the main one.

Is this possible (So I don't need to configure each computer, only one?). I guess I'd have to use the same distro, right? Also, would the server need to have good stats? (I'm thinking of using a 600mhz/256mb ram machine for it).

What would this be called, and do you know any good FAQs/sites about it?

Thanks!
chrisw
you could set it up as an nfs server but i dont know
how to do that quite yet...dont have enough computers to
put strictly linux on.....
hughesjr
You can use NFS to store people's home directories on one computer and mount that on the other computers ...

...but you would also have to link the /etc/passwd, /etc/groups, /etc/shadow and /etc/gshadow from the main computer to the other 2.

It should be possible to do it ... I haven't ever done it though.
Termina
O_o

NFS = Network File System? I've heard the term in this solaris thing I was listening too... was boring so I ignored it. ;-_-

So I'd make a NFS... partition?... and make a soft link to it from another machine?
hughesjr
Yep, NFS is Network File System ....

First off ... if you are going to turn on NFS, make sure you have a good firewall protecting from connections from the outside. VERY IMPORTANT!

What you would do is on the machine you call the main machine (we'll just say server from now on) is make sure NFS is installed. How depends on the distro. There can be packages or 1 package that needs to be installed.

1. Redhat distro's (Redhat/Fedora/WhiteBox/CentOS), 1 package called nfs-utils
2. Mandrake, 2 packages called nfs-utils, nfs-utils-clients
3. Slackware, 1 package, called nfs-utils
4. Debian, nfs-common and either nfs-user or nfs-kernel (I use nfs-kernel ... it is like the other distros)
5. Gentoo, 1 package called nfs-utils
6. SuSE, nfs-utils, yast2-nfs-clients, yast2-nfs-servers

---------------------------------
All the computers envolved in this would need to have the same type of password controls(same encryption, same permissions, same users, etc.), and the same versions of all programs that store items in the users home directory (like Mozilla, Gnome, XFree86, KDE, Evolution, etc.). Since all the versions need to be the same ... it would be best of all distros in the 3 computer group are the same ... and that you maintain them with the same updates.

Once you have the NFS packages installed on the server, you would put the directories you want to share in /etc/exports. I would make the shares kind of tight .... because you would have to allow root to write to the /etc/group, /etc/gshadow, /etc/passwd, and /etc/shadow.

I would do this ... create a directory on the server called /etc/export. Move the following files inside the /etc/export directory (on the server) ...

group
group-
gshadow
gshadow-
passwd
passwd-
shadow
shadow-


Like this (from within /etc directory as root) ....:

mv group export/
(do that for all the other files in the list)

Then create links back to the original file locations (from within /etc as root)

ln -s export/group .
(do that for all the other files in the list)

So now, on the server, ls -al /etc | grep passwd
CODE
[root@CentOS-31 etc]# ls -al /etc | grep passwd
lrwxrwxrwx    1 root     root           13 Apr  3 09:42 passwd -> export/passwd
lrwxrwxrwx    1 root     root           14 Apr  3 09:42 passwd- -> export/passwd

and ls -al /etc | grep shadow
CODE
[root@CentOS-31 etc]# ls -al /etc | grep shadow
lrwxrwxrwx    1 root     root           14 Apr  3 09:42 gshadow -> export/gshadow
lrwxrwxrwx    1 root     root           15 Apr  3 09:42 gshadow- -> export/gshadow-
lrwxrwxrwx    1 root     root           13 Apr  3 09:42 shadow -> export/shadow
lrwxrwxrwx    1 root     root           14 Apr  3 09:42 shadow- -> export/shadow-

and ls -al /etc | grep group
CODE
[root@CentOS-31 etc]# ls -al /etc | grep group
lrwxrwxrwx    1 root     root           12 Apr  3 09:42 group -> export/group
lrwxrwxrwx    1 root     root           13 Apr  3 09:42 group- -> export/group-


Then edit the file /etc/exports and add the following line (I am allowing a PC with the IP 192.168.0.29 to connect to the directory /etc/export on my server (192.168.0.26)) with the no_root_squash option ... meaning that root on 192.168.0.29 can write to root files in the shared directory on the server (for me 192.168.0.26). Here is the /etc/exports line:

/etc/export 192.168.0.29(rw,sync,no_root_squash)

some important issues ... make sure there is no space between 192.168.0.29 and the (rw,sync,no_root_squash) ... other wise, everyone gets default permissions to the share ... (that would be the space) and then 192.168.0.29 would have the specified permissions as well.

Now on the server start nfs ... for my server it would be /etc/init.d/nfs restart (I'm testing on a RedHat distro).

for ease of making connections, turn off iptables on each machine ... (or make and iptables entry that allows all connections {udp,tcp} for 192.168.0.29 to 192.168.0.26 ... and all connections {udp,tcp} for 192.168.0.26 to 192.168.0.29).
-------------
Now you need to make a directory called /etc/export on the client ... then mount the nfs directory like this:

mount -t nfs 192.168.0.29:/etc/export /etc/export

once the mount is sucessful (you will have to take care of iptables issues), go to /etc/export on the client{in my case 192.168.0.29} and make sure the files are there ... ls -al /etc/export shows files and no links ... similar to this:
CODE
drwxr-xr-x    2 root     root         4096 Apr  3 09:41 .
drwxr-xr-x   61 root     root         8192 Apr  3 09:42 ..
-rw-r--r--    1 root     root          577 Apr  1 05:23 group
-rw-r--r--    1 root     root          563 Apr  1 05:23 group-
-r--------    1 root     root          475 Apr  1 05:23 gshadow
-r--------    1 root     root          463 Apr  1 05:23 gshadow-
-rw-r--r--    1 root     root         1519 Apr  1 05:23 passwd
-rw-r--r--    1 root     root         1519 Apr  1 05:23 passwd-
-r--------    1 root     root          992 Apr  1 05:23 shadow
-r--------    1 root     root          960 Apr  1 05:23 shadow-


move the files we are going to share from the server to .bak files like this (in the /etc directory on the client)

cd /etc
mv group group.bak
mv group- group-.bak


and so on for all the files listed in above {group group- gshadow gshadow- passwd passwd- shadow shadow-}.

then link to the files in /etc/export (which are the files on the server ... from the nfs share) like this (from within /etc on the client):

ln -s export/group .
(do that for all the files {group group- gshadow gshadow- passwd passwd- shadow shadow-})

Now .... if you make a change on the server or the clinet to a user it should be in both places after it is saved....

try logging in on the client ... DO NOT RESTART THE CLIENT AT THIS POINT! (the changes are manual and if you restart, since the iptables changes and mount won't happen, you will not have any files in /etc/export, so you will not be able to login to the client. For a test, just press Ctrl-Alt-F2 and login as a user on the client machine. If it works and all the client files in /etc are links to /etc/export ... we are part of the way there.
--------------
Next is sharing the home directories (except /root) with NFS .... to do this, on the server, you would add /home to the /etc/exports file like this:

/etc/export 192.168.0.29(rw,sync,no_root_squash)
/home 192.168.0.29(rw,sync,no_root_squash)


Now you want to restart NFS for the server ... for me it is /etc/init.d/nfs restart

then on the clinet, you want to move the /home directory to /home.bak like this:

mv /home /home.bak

Now you need a blank /home directory to mount into...on the client

mkdir /home

the command (on the clinet) ls -al /home should have no directories in it now).

then mount the /home from the server to /home on the client with the command:

mount -t nfs 192.168.0.26:/home /home

Now the command ls -al /home should contain all the home directories on the server....

NOW ... you should be able to create a new user on the server as a test user and then login as that user on both the server and the client....
--------------
BEFORE you actually do this ... here are the negatives:

1. if the server is down ... you can't login to the server or the clients.

2. You need to have the same program versions on the clients and the server (like mozilla and KDE and GNOME, etc...basically, they need to be the same distro and have the same programs (or there will be errors when trying to run things) because the menus you see are going to be the same on each machine.
---------------
If you want to do this, I would now work on making the changes permanent ....

The first step would be to create iptables rules to allow NFS to work between the machines ... then to setup /etc/fstab to automatically mount the shares.
----------------
If you want to go back ... the server should work as is ... copy all the .bak files we made in /etc to /etc/export on the client and remove the .bak ... then the links in /etc/will point to /etc/exports and work. You could then remove the files in /etc/export (the .bak files should still be in /etc) and mount the nfs share later to get the NFS way to work without making to many changes. You would also need to remove /home on the clinet and do: ln -s /home.bak /home to get back to normal on the client.
---------------
If you understand everything, and want to try it, I can help you make the NFS mounts permanent and automatic...
hughesjr
BTW ... I just did this on a CentOS 3.1 server and WhiteBox Client (with the same programs intalled) ... everything worked fine.
Termina
Thanks for the great explanation (and sorry for the late reply).

Quck question though, before I try this.

QUOTE
All the computers envolved in this would need to have the same type of password controls(same encryption, same permissions, same users, etc.), and the same versions of all programs that store items in the users home directory (like Mozilla, Gnome, XFree86, KDE, Evolution, etc.). Since all the versions need to be the same ... it would be best of all distros in the 3 computer group are the same ... and that you maintain them with the same updates.


So I can't, say, have a machine with nothing but a base install, and have the server give me all the programs I need?
hughesjr
Well ..... in my senario ... the login and home directories are shared, but they point to files on the local machines. In the case of these home directories, since you are using the same one on each login, you will have the same menus on all machines.... This senario allows you to spread out the load among many machines and still put your files in you home directory.

You could share other directories that contain programs ... and always run the programs on one machine, in the shared folders ...

BUT, that would require building software from sources and installing in a directory other than the standard /usr/bin location

I real pain to do, but it can be done.

If you were to do this, the server would have all the LOAD ... and the other machines would be pretty much worthless (except for local logins).

they would basically become terminals.
--------------------------

But running programs across a network connection is not very pleasant ... better would be running the program on the server and connecting via some kind of shared X senario ... so the GUI info is tranfered to the other PC, but not the whole program data.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.