Working under a limited access environment with chroot jail

Image

For normal users of a GNU/Linux system, chroot command may not be quite familiar to them. Whereas explanation is totally unnecessary for people working at the server side. The term jail is used in the sense to convey the concept of limited access. chroot is commonly used to run command or interactive shell with special root directory. On installing a GNU/Linux system / is the root directory and all the programs are rooted at /. All files are accessible inside / and not from outside. Without changing the current situation we now tend to create another environment whose root directory some place other than /. This new root directory can be defined using the chroot command. For establishing such an environment first we need to find/create a empty directory as the new root directory. For instance, suppose /home/user/jail is our new root. Now,
Get into the directory
$cd /home/user/jail
Create a subdirectory named bin
$mkdir bin
Read More »

Recover hidden GNU/Linux after installing Windows with live ISO

Image

Most often GNU/Linux becomes hidden after installing/re-installing windows. It is because windows overrides the traditional GRUB from GNU/Linux with
its own boot loader which cannot detect other operating systems. Whereas GRUB is capable of recognizing other operating systems(including Macintosh,
windows etc). So the solution is cut and clear, just re-install the GRUB. But it requires a live GNU/Linux distro. Since I use Ubuntu here a provide a link to download the ISO for Ubuntu because it contains GRUB(don’t think that Ubuntu is the only one with GRUB). If you choose another distro, make
sure that it includes GRUB.

1. Download the live ISO.
2. Use the ISO to make a bootable USB or CD/DVD(better to use unetbootin to make a bootable flash drive).
3. Boot the same before getting into windows by making the first boot device to CD/DVD or any external device in BIOS.
4. Choose the option Try Ubuntu Without Installing.
5. Access the terminal by pressing Ctrl+Alt+T.
Read More »

Enable remote access to MySQL database server

For most of the database users in a particular network may need to access the database from a remote machine connected in LAN. By default remote access to the MySQL database server is disabled for security reasons. However, sometimes you need to provide remote access to database server from home or a web server. In order to enable the same follow the guidelines given below.

1.Make sure you have a firm connection between two machines (better to test the connection via ping).
2.Login to the MySQL database server through ssh
ssh user@hostname
3.Locate the file my.cnf
Probable locations are /etc/mysql/my.cnf or /etc/my.cnf.
4.Edit the file
nano /etc/mysql/my.cnf
5.Make sure that you comment the line skip-networking to look like
# skip-networking
6.Move to the line where ‘bind-address = ‘ is written and substitute the ip with the MySQL server ip.
bind-address = YOUR_SERVER_IP
7.Save and close the file
8.Restart MySQL server using
service mysql restart or /etc/init.d/mysql restart or /etc/init.d/mysqld restart
9.To grant access to a particular remote ip, connect to the MySQL server
$ mysql -u root -p 123456

where 123456 is the mysql root password(substitute the password accordingly).

And to grant access over a complete database
mysql>grant all on test.* to tom@’192.168.1.1′ identified by ‘passwd’;

tom is the remote user and 192.168.1.1 is the remote ip. Choose a password instead of passwd.

Quit MySQL by
mysql>exit

You can use this username and password in any programming language that support MySQL for accessing the remote database.
For example in Java a statement like
static Connection conn = DriverManager.getConnection(“jdbc:mysql://YOUR_SERVER_IP/test”,”tom”,”passwd”);
can establish a connection to the remote database ‘test’.