Archive

Posts Tagged ‘unix’

Start Sun One Web Server 7 on boot (Solaris 9)

June 10th, 2009

During the Sun One Web Server install, there is an option to have the web server start on system boot or reboot. In the case that you did not select this option, but would like the web server to start on boot, here’s how you do it.

  1. su -
  2. cd /etc/init.d
  3. create a file named SunWebServer7, and add the following:
    #!/sbin/sh

    #start SunOneWebServer 7 on system restart and boot

    case “$1″ in
    start)
    /var/opt/SUNWwbsvr7/https-SERVERNAME.com/bin/startserv
    ;;
    stop)
    /var/opt/SUNWwbsvr7/https-SERVERNAME.com/bin/stopserv
    ;;
    restart)
    /var/opt/SUNWwbsvr7/https-SERVERNAME.com/bin/restartserv
    ;;
    *)
    echo $”usage: $0 {start|stop|restart}”
    exit 1
    esac

  4. replace SERVERNAME with the name of your server
  5. make sure SunWebServer7 has the same ownership and permissions as the other files in the /etc/init.d directory
  6. create symbolic links to this script in the /etc/rc*.d/ directories. For example:

    ln -s /etc/init.d/SunWebServer7 /etc/rc0.d/K99SunWebServer

linux/unix, web server , ,

SSH Authorized Keys setup – login with no password

March 6th, 2009

SSH Authorized keys allow you to login to a Linux server with no password. This is particularly helpful if you are running an automated script, like a cron job.

For this example, let’s say you want to login in to server B from server A with no password.

a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory ‘/home/a/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

Now use ssh to create a directory ~/.ssh as user a on B. (The directory may already exist, which is fine):

a@A:~> ssh a@B mkdir -p .ssh
a@B’s password:

Finally append a’s new public key to a@B:.ssh/authorized_keys and enter a’s password one last time:

a@A:~> cat .ssh/id_rsa.pub | ssh a@B ‘cat >> .ssh/authorized_keys’
a@B’s password:

From now on you can log into B as a from A as a without password:

a@A:~> ssh a@B

If you would like to login to other remote server C, do not generate a new id_rsa.pub file. Just do the following:

a@A:~> cat .ssh/id_rsa.pub | ssh a@C ‘cat >> .ssh/authorized_keys’
a@C’s password:

linux/unix, ssh

how to shutdown a Solaris server

February 5th, 2009

Here’s how to shutdown a Solaris server:

  1. login as root
  2. at the command line, type “sync”
  3. type “sync” a second time
  4. now type /etc/telinit 0   (NOTE: 0 = shutdown, s = single user mode, 6 = reboot)
  5. you will eventually get to an ‘ok’ prompt

From here you can actually unplug the server. If you would like to start the server up again, just type “boot” at the “ok” prompt.

linux/unix , ,