Showing posts with label recipe. Show all posts
Showing posts with label recipe. Show all posts

Friday, February 29, 2008

Micro-Recipe: Setting up a static IP on your Ubuntu Linux

Assuming your static IP is 192.168.0.100, your machine's name is computer, and you're on the mydomain.com domain.

  • nano /etc/network/interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.100
gateway 192.168.0.1
netmask 255.255.255.0
  • nano /etc/hostname
computer
  • nano /etc/resolv.conf
mydomain.com

Thursday, February 14, 2008

Micro-Recipe: Generate keys for passwordless SSH & SCP

Micro-recipe to avoid entering your password each time you do an ssh or an scp from a local machine to a remote one.

Local machine (enter passphrase each time) ->

  • ssh-keygen -t rsa1
  • ssh-keygen -t dsa
  • ssh-keygen -t rsa (if you do only one, do this one)
Remote machine ->
  • Append the content of each of the local ~/.ssh/identity.pub, ~/.ssh/id_dsa.pub, ~/.ssh/id_rsa.pub files to the remote ~/.ssh/authorized_keys one each time on a separate line.
Local machine ->
  • Execute this script every time you restart your linux box to start the ssh agent.
ssh_info_file=~/.ssh-agent-info-`hostname`
ssh-agent >$ssh_info_file
chmod 600 $ssh_info_file
. $ssh_info_file
for i in identity id_dsa id_rsa
do
ssh-add ~/.ssh/$i
done


Attach each shell to the ssh agent.
  • . ~/.ssh-agent-info-`hostname`
Complete recipe: http://www.cvrti.utah.edu/~dustman/no-more-pw-ssh/

Wednesday, January 9, 2008

Micro-Recipe: Ubuntu Mysql Root Password Restoring

Here are the bare bone commands to restore your mysql root password ->

  • /etc/init.d/mysql stop
  • /usr/bin/mysqld_safe –skip-grant-tables &
  • mysql -u root mysql
  • mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE User='root';
  • mysql> FLUSH PRIVILEGES;
  • mysql> exit;

Testing if it works ->

  • /etc/init.d/mysql restart
  • mysql -u root -p
  • Enter password:
  • mysql> You win !

Then add a mysql user with all privileges ->

  • mysql -u root -p
  • mysql> GRANT ALL PRIVILEGES ON *.* TO 'login'@'localhost' IDENTIFIED BY 'pass' WITH GRANT OPTION;
  • mysql> FLUSH PRIVILEGES;