Server 4 move » History » Version 1
iri, 10/07/2012 05:42 PM
1 | 1 | iri | h1. Move a server to another system user |
---|---|---|---|
2 | |||
3 | On GNUlinux, the installation recommend (!) to be root to install the server. Often, the server inherit the same rights ... This is *very* dangerous ! You should put the Scol server under a _normal_ system user. |
||
4 | Moreover, this will be easier and more secure to upload files and other resources to the server. |
||
5 | |||
6 | However, if the server is already installed, you can follow this tutorial (for a Debian system, but you could adapt it easely for another GNU/Linux system). |
||
7 | +Note+ : For a FreeBSD system, you should read this "tutorial":http://iri3d.free.fr/Docs/scs_scol/scolFbsdHT.html |
||
8 | |||
9 | # Connect you to the server machine (via SSH by example) : |
||
10 | <pre> |
||
11 | $ ssh my_user@123.456.789.012 |
||
12 | </pre> |
||
13 | # Save your current Scol directory (backup) |
||
14 | # Create a new system user |
||
15 | 3.1. Log in you in _root_ (or other user with sufficient rights) |
||
16 | <pre>$ su -</pre> |
||
17 | 3.2. Create a simple user |
||
18 | <pre>$ adduser new_user</pre> |
||
19 | Note : you can pass any argument to _adduser_ like _-disabled-password_. This forbids _new_user_ to connect except by SSH and RSA key. For more informations, enter in your terminal : <pre>$ man adduser</pre> |
||
20 | # Create a new group, like _new_group_ with the command <pre>$ addgroup new_group</pre> Put _new_user_ in _new_group_. |
||
21 | # Copy (or move) the current Scol directory in the _new_user_ directory (typically _/home/new_user/_) |
||
22 | <pre>$ cp -R -v /root/scol /home/new_user/scol</pre> |
||
23 | The option -v is optional. It displays informations on the current operations. |
||
24 | # Modify the rights on _/home/new_user/scol_ to _new_user |
||
25 | <pre>$ cd /home/new_user |
||
26 | $ chown -R -v new_user:new_group scol</pre> |
||
27 | # Edit the file _/home/nex_user/scol/usm.ini_ (with nano by example) |
||
28 | <pre>$ nano scol/usm.ini</pre> |
||
29 | Modify the _masteruser_ value (by default, at the last line) |
||
30 | <pre>$masteruser new_user</pre> |
||
31 | Close nano with CTRL+X, Confirm the change to press Y and the same save path name with Enter |
||
32 | # If any, remove or modify the _start / close_ script (see [[Server 4 start and close]]) |
||
33 | # If running, close the server |
||
34 | <pre>$ killall -TERM usmunix</pre> |
||
35 | # Start the server (from _new_user_) |
||
36 | <pre>$ su new_user |
||
37 | $ cd scol |
||
38 | $ nohup ./startscol.sh &</pre> |
||
39 | # Check if all is ok |
||
40 | 11.1 From a client machine, connect you on <pre>http://ip_du_serveur:1199/</pre> |
||
41 | You should read a list of opened applications (or an empty list, if no applications uploaded) |
||
42 | 11.2 Always from a client machine, connect you on <pre>http://ip_du_serveur:1201/CC/</pre> to configure the Scol server |
||
43 | # If all is ok, you can remove the old Scol directory |
||
44 | <pre>$ exit |
||
45 | $ su - |
||
46 | $ rm -rf /root/scol/ |
||
47 | $ rmdir /root/scol</pre> |
||
48 | Be careful with the _rm -rf_ command, you can damage your system if you do a mistake. |
||
49 | # Log out you |
||
50 | <pre>$ exit |
||
51 | $ exit</pre> |
||
52 | |||
53 | If you want, you can adapt this script to start and close the server : [[Server 4 start and close]] |
||
54 | |||
55 | You can upload and update your resources files via SFTP (ssh + ftp), a better way than ftp only. See the OpenSSH project for more informations. |