notes, references

August 25, 2008

Linux hardware info

Filed under: Linux, ubuntu — karthik @ 2:20 pm
$sudo biosdecode
$sudo dmidecode
$sudo dmesg
$sudo cat /proc/cpuinfo
$sudo cat /proc/meminfo

Get Information About Your BIOS / Server Hardware From a Shell Without Opening Chassis ( BIOS Decoder )

List open ports – netstat

Filed under: Linux, Windows Networking — karthik @ 1:16 am

netstat can be used to list all open ports on a machine

Linux

$ netstat -an | grep -i listen
Command options will be different in diff version of linux

Windows

> netstat -a | find /i "listening"
> netstat -b     //will show the process names
> netstat -?

Some links on the web
http://blogs.techrepublic.com.com/security/?p=443
http://www.petri.co.il/quickly_find_local_open_ports.htm

January 23, 2008

Apache with HTTPs on Ubuntu

Filed under: Apache, https, Linux, ssl, ubuntu — Tags: , , , , — karthik @ 11:03 pm

Apache with HTTPs

Basic idea
(https://help.ubuntu.com/community/forum/server/apache2/SSL)

  1. setup ssl ceritifcates
    1. you can use apache_ssl_certificate (some newer version of ubuntu are missing this, see below)
    2. $sudo apache2-ssl-certificate -days 365
  2. enable mod_ssl
    1. $sudo a2enmod
  3. Listen to port 443
    1. add ‘Listen 443′ to ports.conf (without the quotes)
  4. setup a apache site under sites-available
    1. make a copy the sites-available/default to sites-available/ssl
    2. modify available-sites/default
      1. NameVirtualHost *:80
      2. <virtualhost *:80>
    3. modify available-sites/ssl
      1. NameVirtualHost *:443
      2. <virtualhost *:443>
      3. SSLEngine On
      4. SLCertificateFile /etc/apache2/ssl/apache.pem
  5. enable the ssl site
    1. sudo a2ensite ssl
  6. setup rewrite rules for any of the pages that you want to be accessed always by ssl; include these rules in default site
    1. for example if you want your bugzilla page to go to https
    2. RewriteEngine on
    3. RewriteCond %{SERVER_PORT} ^80$
      RewriteRule ^/bugzilla(.*)$ https://%{SERVER_NAME}/bugzilla$1 [L,R]

Instructions

apache2-ssl-certifcate not found

  • the apache2-ssl-certificate and other reqd files are not found in Fiesty and some other distributions
  • the bug that discusses this is here https://bugs.launchpad.net/debian/+source/apache2/+bug/77675
  • they discuss what can be done and one of them suggests using steps given in mod ssl docs directly; the link for mod-ssl docs is below

Links from which info was compiled

  • https://help.ubuntu.com/community/forum/server/apache2/SSL
  • http://ubuntuforums.org/archive/index.php/t-4466.html
    • discusses apache and apache2; you can find apache2 if you scroll down
  • http://www.linode.com/wiki/index.php/Apache2_SSL_in_Ubuntu#Apache2_SSL
  • http://www.modssl.org/docs/2.8/ssl_faq.html#ToC28
    • mod ssl docs -lots of information; was mentioned in a ubuntu bug-report
  • http://httpd.apache.org/docs/2.0/ssl/ssl_howto.html

May 23, 2007

unix – find files

Filed under: Linux, ubuntu, unix — karthik @ 5:47 pm
(most of the unix shell script have been taken from refs on the web andthe oreilly book unix-power-tools)
  1. Finding files that contains a particular word or string:
    1. $find . -name '*.css' -type f -print | xargs fgrep 'myParagraphStyle' /dev/null
    2. /dev/null – adding this makes grep print the match even if it just matches one file
    3. xargs – splits long set of arguments into chunks; this will prevent the command line exceeding any limits the command might have
    4. fgrep is same as ‘grep -F‘; this makes grep treat the search pattern as fixed strings separated by new lines any of which is to be matched
  2. Using what you find with exec
    1. $find . -name '*.css' -exec echo {} \;
    2. When not using xargs, -exec can be used to get find to execute a command on what it finds; the output of find can be given to another find command
    3. {} is a special argument that contains the name of the file – found by the find command
    4. Semicolon is used to indicate to find the end of the command that find has to execute; the semi-colon must be escaped either \; or ';' so all execs end with a semi-colon
    5. Example copying files
      $find /data/bkups/
      -name 'svn_2007-06-01.[0-9][0-9]'
      -exec sudo cp {}
      /media/bkupserver/svnbkups/svn_2007-06-01/ \;
  3. [placeholder]

May 21, 2007

Windows Shared folder from Ubuntu

Filed under: File Sharing, Linux, ubuntu — karthik @ 7:31 am

Ubuntu and windows file sharing is covered on so many web sites in great detail – searching for ubuntu Samba file sharing mount windows share etc will get many links

http://ubuntuforums.org/showthread.php?t=280473

http://ubuntuguide.org/wiki/Ubuntu:Feisty

http://doc.gwos.org/index.php/Share_files_using_Samba

http://ubuntuforums.org/showthread.php?t=202605

https://help.ubuntu.com/ubuntu/serverguide/C/configuring-samba.html#windows-networking-clients

All I want to do is mount a windows shared folder on my ubuntu box and access the files; I am not worried about mounting during boot up and not sharing any files from ubuntu.

  1. install smbfs
    1. $sudo apt-get install smbfs
  2. use ‘mount’ to mount the file share
    1. for mount you need to create a local folder that will be the mount point for example create a folder test under /media
    2. then mount the share using
      1. $sudo mount -t smbfs -o username=myusername //192.168.0.10/sharename /media/test
      2. myusername – is a valid username on the windows machine
      3. the ip address is the ip of the windows machine
      4. sharename is the name given to the share on the windows machine
      5. This will prompt you for the passwor d- the password for myusername on the windows machine
      6. on successful password you will be able to see the contents of the sharedfolder under /media/test
      7. Note: if you this is the first time you are using sudo in this shell session or if sudo has timed out there will be two password prompts first for the sudo next for the share mount. you could avoid this by doing $sudo -v before doing the sudo mount
  3. to umount
    1. $sudo umount /media/test

May 17, 2007

linux, ubuntu version

Filed under: Linux, ubuntu — karthik @ 9:33 pm

lsb_release (Linux Standard Base) prints system information with some distribution specific information
$lsb_release -a

uname prints system information like kernel info etc
$uname -a

January 4, 2007

text-based browser

Filed under: Linux, ubuntu — karthik @ 9:26 pm

text-based browser for using in linux console

  • w3m – comes with ubuntu
  • elinks – available as package for download

August 22, 2006

Ubuntu package management, find installed package info

Filed under: Linux, ubuntu — karthik @ 5:25 am

[2008-05-29]
Since Ubuntu 7.04 TaskSel is available, this allows installing software package groups like

$sudo tasksel install lampserver
 (will install the all packages for lamp server)
$sudo tasksel
(will bring up a nice menu of software that can be installed)

There is tons of help on the web about using apt-get and other utils.

To find installed packages and information about the packages use

$dpkg -l
$dpkg --list
$dpkg -l 'pattern'

apt-get is great utility to use to manage installation and removal of software. typicall usage:

$sudo apt-get install <package-name>
$sudo apt-get remove <package-name>

[2007-10-29]
Search for packages using a pattern:

$apt-cache search pattern

(http://www.howtogeek.com/howto/ubuntu/search-for-install-packages-from-the-ubuntu-command-line/)

July 25, 2006

linux users, groups

Filed under: Linux, ubuntu — karthik @ 12:55 am

utilities/commands:

$useradd
$userdel
$usermod

more user-friendly – adduser, deluser

——————————————–
list of usernames of users currently logged in
$users

show who is logged on, with info
$who

show who and what they are doing
$w

your user id, the user currently logged in, in this session
$whoami

list of all users in the system
- is in the file /etc/passwd
to list just the user names use
$awk -F: '{print $1}' /etc/passwd

——————————————–
print user identity and ids of all groups the user belongs to
$id

prints the groups a user is a member of
$groups

——————————————–

password management
$passwd
super user can use the same command to set passwords and other options for other users
especially useful with the -e option that sets the password to expire immediately, forcing the user to change password the next time they login
$passwd -e

July 17, 2006

linux man

Filed under: Linux, ubuntu — karthik @ 12:00 am

you want to know something use man.

http://www.comptechdoc.org/os/linux/usersguide/linux_ughelp.html

man -k <keyword> => used to search for keyword
apropos <keyword> => same as man -k

Once the man page is opened navigating through the displayed man page is based on the less command, press ‘h’ to find out the shortcut keys that can be used.

Older Posts »

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.