search

Loading

Sunday, December 8, 2013

Port forwarding port 80 of public static ip to internal machines port 8080 in centos using iptables

I have a centos server acting as router. It has two ethernet ports eth0 and eth1. eth0 is configured with the public static ip got from my ISP. I have my internal machines connected to this centos os router machine using LAN in eth1.

For example, assume that my public static ip given by my ISP is 123.45.567.89 and it is configured in eth0. In eth1 my internal machines are connected through LAN. Internal machines are in the ip range of 192.168.1.0 to 192.168.1.100

I have a web application running on one of my internal machines with IP 192.168.1.10 on port 8080. I can access this web app from my internal network by typing http://192.168.1.10:8080/ in a web browser. But I want to get this application from my public static ip given by ISP by simply typing http://123.45.567.89/ in the web browser. How can I achieve this? By port forwarding. Follow the below steps to achieve this.

Install MTS MBLAZE 3GPLUS/MBLAZE ULTRA dongle for ZTE in Ubuntu Linux

I had recently got MTS 3GPLUS dongle. It is made ZTE and really good news about it is that it supports Linux and it is mentioned in their website (you can view the supported os list in "tech spec"). I have tried it in Windows 8, OSX Mavericks and Ubuntu 13.04 and it works really well on all these platforms.

In mac and windows, it will auto configure everything for you. But in Linux, you need to install it manually. When I plugged it into my ubuntu, it was detected as USB drive but there was no auto configure for it. Even I was not able to load the installation files in Ubuntu. Then I have to plug it into another Windows and was able to see it includes the files for installing it in Linux too.

Saturday, November 23, 2013

How to create a user to ssh to the server and then only have super user permission to switch to root user?

I don't want to ssh to my linux server as root user. So I have disabled the direct root login through ssh. I am using a less privileged user to ssh to the server. But I don't want to give him sudo privilege. The only privileged command this user (less privileged user) should be able to run is to switch to root user. How can I achieve this?

I'm using Amazon Linux (which is actually centos based) in my ec2 instance. It comes with 'ec2-user' which has no password and but has sudo privilege and uses ssh key for login. I want to use password login for other users (and don't want to use ssh key for them)[So I can't disable password login "PasswordAuthentication  no" field in sshd_config file]. But I also want to set password for 'ec2-user' as I don't want to use sudo command without password. I have used below setup to achieve this.

How to delete file names with spaces older than 30 days in linux?

I want to delete files which are modified before 30 days from a public folder (uploads) in my linux server. The files are uploaded by different users so it includes white spaces and other characters in the file name. How can I automate this process?

You can use any of the below commands to achieve this:

Saturday, September 7, 2013

How to delete a user from a group using single command in linux?

I have created a user called 'sam' and he is a member of the group 'webdeveloper'. Currently he is on long leave and I want to remove him from the web developer group without deleting this user.  How can I do this? We will find below.