wiki:administration/system-admin
close Warning: Can't synchronize with repository "(default)" (/usr/svn/silverfile does not appear to be a Subversion repository.). Look in the Trac log for more information.

SilverFile Server Administration Guide and Tips

Add users to sudo

Sudo allows all users in admin group root privilege. This is something that Ubuntu sets up as an alternative to visudo.

usermod -a -G admin ryan

SSH Keys

To generate a key:

ssh-keygen (or)
ssh-keygen -t dsa (for dsa)
(do not enter a passphrase)

This generates, id_dsa and id_dsa.pub. Client(id_dsa) ---ssh--> Host(id_dsa.pub in .ssh/authorized_keys)

Using GPG

We are using symmetric gpg which just requires the use of a passphrase to encrypt/decrypt files.

To initially create the gpg file the command is:

gpg -c decryptedfile

To render decrypted file to STDOUT (note the additional dash):

gpg -o - file.gpg

Using Vim to edit files in place

Copy the gnupg.vim file to $HOME/.vim/plugin/ View plugin

Note- This vim script is edited slightly to make symmetric encryption the default. This is done by setting g:GPGPreferSymmetric= 1 in the script.

Generate a new SSL Cert

1) Generate the key (2048 bit)

openssl genrsa -des3 -out silverfilecorp.com.key 2048

Specify anything for the key passphrase, ie "silver", it will be removed later.

2) Generate the certificate request for the root authority - i.e. godaddy

openssl req -new -key silverfilecorp.com.key -out silverfilecorp.com.csr

3) Remove passphrase from key. This will enable apache to back online without any intervention.

cp silverfilecorp.com.key silverfilecorp.com.key.encrypted
openssl rsa -in silverfilecorp.com.key.encrypted -out silverfilecorp.com.key

Disk Usage Tools

Get a summary of disk usage for each client folder. Sort the output alphabetically.

du -h --max-depth=1 | sort -k 2

Using Screen

Screen is an excellent utility for managing shell sessions remotely.

screen

Within the new shell, enter Ctr-A d. This disengages you from that shell but still allows it to keep running.

screen -ls (lists screen sessions)
screen -r xxxx.tty.session (allows you to re-attach to a given session)

SSH Tunneling

If you want to tunnel the tomcat instance (running nutch) try this command:

ssh user@harvey.silverfilecorp.com -p 2222 -L 8080:localhost:8080

Init Scripts

Add an init script Add the script to /etc/init.d/ and then run:

update-rc.d script_name defaults

Remove an init script Delete the script from /etc/init.d/ and then run:

update-rc.d script_name remove

Samba Administration

Check samba version (also checks if samba is running)

smbd -V

Use samba client List smb shares on server:

smbclient -L //server -U user

Browse samba share

smbclient //server/share -U user
(or)
smbclient //server/share -U user%password

Django Administration

Dump data in database (assumes settings is in production skin directory)

python manage.py dumpdata --pythonpath=.. --settings=production.settings

Load data from fixture (json)

python manage.py loaddata /home/sf/dataout.json --pythonpath=.. --settings=production.settings

Alternatively you can load data in with syncdb. Recreate the MySQL db and move the fixture into files/common/fixtures/ naming it initial_data.json. Then run:

python manage.py syncdb --pythonpath=.. --settings=production.settings
Last modified 13 years ago Last modified on Oct 7, 2009, 10:28:09 PM