Tuesday, September 21, 2010

linux tips

  • to mount windows share on linux (ubuntu 10.04)
  • sudo apt-get install samba smbfs (2 installs needed)
  • using smbmount


    sudo smbmount "//11.145.120.61/system" "/home/rxxxx/z-shares/chris-share" -o 'user=rxxxx,pass=15'
    //for Read with Write permission
    sudo smbmount "//11.145.161.9/Users/rxxxx" "/home/rxxxx/z-shares/vdi/raj" -o username=rxxxx,password=xxxxxxxx15,rw,uid=1000
    //make sure use "id" command to look for ur UID 
  • look for who is using port 8410

    netstat -tulpn | grep '8410'
  • look for details of process with 'jboss' in it

    ps -afew | grep jboss
  • ssh to a machine with jboss as user to machine devmachine, using ssh listening(telnet) port 8841 configured, default is 22

    ssh -P 8841 jboss@devmachine
    which prompts for password,
  • to prevent typing password (from chris machine) everytime you can copy public key to remote box as follows

    copy from local ~/.ssh/id_rsa.pub to remote machine


    using scp -P 8841 src destn
    scp -P 8841 ~/.ssh/id_rsa.pub jboss@devmachine:/home/jboss/chris_rsa.pub


    then add this key to authorized keys file in remote box as follows
    cat /home/jboss/chris_rsa.pub >> ~/.ssh/authorized_keys

  • if you do not have rsa (ssh keys) on you r local you can do as follows details about ssh
    gitosis

    ssh-keygen -t rsa

The defaults for the ssh-related commands can be altered for each account in a configuration file ~/.ssh/config (there is also a system-wide file, usually /etc/ssh/ssh_config). Each entry starts with a Host keyword.
Host *panix.com
User suominen
Compression no
Port 8841

If you want to run commands automatically when ssh login

just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:
if [[ -n $SSH_CONNECTION ]] ; then
    echo "I'm logged in remotely"
fi