May 13, 2008
apache
No Comments
To list the files in a directory with apache is very simple. All you have to do is add a directory alias to httpd.conf file. So if i want to add an alias called aliastest to directory /test i would add the following line:
alias /aliastest /test
Then i would go to my url:
http://myurl.com/aliastest
and i would see all files listed in /test directory (of course provided the permissions are set correctly). If i want to password protect it so that i can only see the files if i enter a username and password i add this to the directory section of httpd.conf;
<Directory “/test”>
Options Indexes MultiViews
AllowOverride AuthConfig
AuthName “test”
AuthType Basic
AuthUserFile /test/.htpasswd
AuthGroupFile /dev/null
require user test
Order allow,deny
Allow from all
</Directory>
Don’t forget to add a user;
# /usr/local/apache2/bin./htpasswd -c .htpasswd test
New password:
Re-type new password:
Adding password for user test
Then ensure the settings in the /Directory such as AuthUserfile is correct, restart apache and you’re good. There are many, many options for securing apache and this is very basic, so don’t go hiding sensitive information using this method.
May 13, 2008
Solaris Admin
No Comments
I see this one a fair bit these days, so i thought i would write it up. On most machines when i edit crontab i get the following:
amstel:/ # crontab -e
320
And i have to CTRL-D to get out of it. Note that that 320 can be any number, doesn’t matter. The point is you cannot edit cron.
All you have to do is add this line;
EDITOR=/usr/bin/vi;export EDITOR
To /etc/profile or /.bashrc or /.bash_profile etc.
May 12, 2008
Solaris Framebuffers
No Comments
I recently acquired a second monitor, which i just couldn’t get to talk to me. Because my work station is also the Sunray server for the demo Sunray clients in the office the /etc/dt/config/Xservers file reverts after reboot or dtlogin restart. After stopping the Sunray server with # /etc/init.d/utsvc stop the changes stayed.
Let’s look at the changes required to add a 2nd monitor, whether you’re on a Sunray server or not. If /etc/dt/config directory does not exist you will have to manually create it first.
# cp /usr/dt/config/Xservers /etc/dt/config/Xservers
#cp /usr/dt/config/Xconfig /etc/dt/config/Xconfig
Then you will have to change /etc/dt/config/Xservers line from:
:0 Local local_uid@console root /usr/X11/bin/Xserver :0 -nobanner
to (in my case at least - check your framebuffer type with fbconfig -list):
:0 Local local_uid@console root /usr/openwin/bin/Xsun +xinerama -dev /dev/fbs/pfb0a -dev /dev/fbs/pfb0b
To make the changes take effect you can either reboot or restart dtlogin using the following method. Logout, and at the welcome screen click on ‘command line logon’. Login, stop and start dtlogin using /etc/init.d/dtlogin stop then /etc/init.d/dtlogin start. Exit the command line session and wait for the welcome screen again. You should now have both monitors running in xinerama mode. If you don’t want xinerama mode just remove the +xinerama bit.
Don’t forget to restart your Sunray if you have one. # /etc/init.d/utsvc start.
GOTCHA: If you reboot your system you will have to stop Sunray services again, or the Xservers file will be replaced with the default. Also, xinerama is a cpu hog, at times more than doubling the amount of cpu resources required if you ran dual monitor without xinerama. Unfortunately my ex-manager that arranged this system was cheap and only put 1 cpu in.
May 9, 2008
Solaris Admin
No Comments
If you create your own smf manifests you undoubtedly have come across the “svccfg: couldn’t parse document” error. It indicates there is a fault in the xml file you are trying to parse. Unfortunately it does not provide any clues at all as to where the error lies.
Thankfully solaris also ships with the xmllint command:
# xmllint –valid ndd-nettune.xml
ndd-nettune.xml:2: I/O error : failed to load external entity “NULL”
<!DOCTYPE service_bundle SYSTEM “/usr/share/lib/xml/dtd/ service_bundle.dtd.1″>
^
ndd-nettune.xml:7: validity error : Validation failed: no DTD found !
<service_bundle type=’manifest’ name=’SUNWcsr:ndd’>
^
ndd-nettune.xml:47: parser error : Opening and ending tag mismatch: service line 9 and exec_method
</exec_method>
^
ndd-nettune.xml:75: parser error : Extra content at the end of the document
</service>
After the removal of redundant spaces and lines, and missing /> tags i tried again.
# svccfg validate ndd-nettune.xml
#
Alright, no unwanted error messages this time.