Showing posts with label administration. Show all posts
Showing posts with label administration. Show all posts

Wednesday, June 9, 2010

Creating a home directory for root in Solaris 10

Abstract: In Solaris 10, '/' is the default home folder for root. While effective, it's also messy, allowing root's personal files and directories to intermix with the system files. The following explains how to clean up the '/' directory and is easiest if done immediately after installing Solaris. Before starting: you'll need root access to complete the following and you should decide on the new root folder location.
Recommended root folder locations:
/root (the one used later in this post)
/export/home/root (consistent with other user home directories on the system)

Login: non-root account
(Create one with the useradd command as root if necessary.)

$ su
Password: root-password
# usermod -d /root -m root
# exit


What just happened:

su assumed super user role

usermod -d /root -m root modified the root account with these options:

-d /root root's new directory is /root

-m makes(creates) the new directory

root user account that is modified

exit some changes can't be made while the user is logged in

Now to move root's personal files to the new home folder.

# ls -al /
# mv root-personal-files
# cp possible personal files

Examine the 'ls -al /' results. Leave everything owned by 'sys' in the / directory.
Directories: most directories in /, especially large ones with lots of sub-directories, stay in /. If you think but aren't sure that a directory belongs in the new home directory, leave a copy in / and put a copy the new home directory.
Individual files: especially .files like .profile probably belong in your folder.

Saturday, February 13, 2010

Solaris 10: Using CGI on Apache2 for beginners


Abstract: There are many helpful books and web-pages to assist beginning CGI programmers. Unfortunately most assume that one is uploading their files to a professionally administered server. This blog is aimed at those who have full access to a stock Solaris 10/Apache2 webserver.

Step 1: Enable Apache2 according to this post.

2: Login as super-user.

3: Change the cgi-bin folder permissions.

# chmod 775 /var/
apache2/cgi-bin


4: Save a valid cgi file to the ../cgi-bin directory. My test file is "first.cgi" which is borrowed from the excellent tutorial "CGI Programming 101" by Jaqueline Hamilton.
#!/usr/bin/perl -wT 
print "Content-type: text/html\n\n";

print "Hello, world!\n";

5: Set the file permissions.

# chmod 755 ..cgi-bin/first.cgi

6: Access your website to test the file.

http://your-site.net/cgi-bin/first.cgi

You should see "Hello World" on a plain background (or whatever your test file specified should happen).

Notes:

Solaris 10 comes with Apache and Apache2 installed (but inactive). Ensure that you don't confuse them (i.e. saving files in the wrong directories).

Apache2 does not require .cgi at the end of CGI files but does require the full file name when running it in a browser.