Change permissions of files, folders and sub-folders in linux

Let’s assume we have a folder /opt/docs/ and we have to create bellow folder tree, which are used by Accounts, HR and Sales divisions. Each folder is accessible to respective devisions only and others must not have any access to it.

/opt/docs/
|-- Accounts
|       `-- Employee
|-- HR
|      `-- Employee
`-- Sales
`-- Customers

To make the folder strcuture,

mkdir -p /opt/docs/Accounts/Employee
mkdir -p /opt/docs/HR/Employee
mkdir -p /opt/docs/Sales/Customers

To change ownerships to respective divisions,

chown -R accounts:accounts /opt/docs/Accounts/Employee
chown -R hr:hr /opt/docs/HR/Employee
chown -R sales:sales /opt/docs/Sales/Customers

To set access permissions only to respective divisions,

find /opt/docs/ -type d -exec chmod -v 0770 ‘{}’ \; # directory permissions
find /opt/docs/ -type f -exec chmod -v 0660 ‘{}’ \; # file permissions

Configuring SFTP CHROOT service


Let’s consider a situation where you need to configure a secure FTP service in your Linux server without installing any new packages to the system. Easy way of achieving this scenario is by configuring a SFTP CHROOT service in your Linux system. By Default all Linux systems are pre configured with SSH service. There for you only need to edit the existing configuration for this purpose.

1) Modify “/etc/ssh/sshd_config” file to reflect bellow changes

#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem       sftp    internal-sftp

Continue reading

How to increase maximum connections limit in mysql without a restart

Default maximum concurrent connections a mysql database server can handle is set as 100. If you require your mysql database server to serve higher number of concurrent connects than 100, you can set this on the fly as bellow without restarting the mysqld service. Make sure you have enough hardware resources (Generally RAM) to accommodate more connections.

To check current maximum concurrent connections,

mysql> show variables like “max_connections”;
+—————--+——-+
| Variable_name | Value |
+—————--+——-+
| max_connections | 100 |
+—————--+——-+
1 row in set (0.01 sec)

Continue reading

Enable multiple users Read and Write permission for files within a folder

Lets assume we have two web developers working on the same web project and they will need a single shared location to store and collaborate their development work with each other. In bellow example I have taken “/var/web-dev” as the shared location and it’s owned by Apache user (www-data). Two developers, danny and penny, needs to store their development work in “/var/web-dev”.

Assuming we already has logins for danny and penny, we have to add them to Apache user group.

usermod -aG www-data danny
usermod -aG www-data penny

Continue reading

Installing softwares to RHEL5 without RHN subscription

To Install software to Red Hat 5 Enterprise Linux when your installation is not registered with Red Hat Network, simple solution is to install the software from the installation DVD.

If you have an ISO file of the installed OS version, mount it to /mnt/cd

Then create a file “iso.repo” in /etc/yum.repos.d

[base]
name=DVDROM
baseurl=file:///mnt/cd/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Host CPU incompatible issue when migrating virtual machines between ESX hosts

 

I was trying to migrate a virtual machine from one ESX host to another and received following validation error, “Host CPU is incompatible with the virtual machine’s requirements at CPUID level 0x1 register ‘ecx’.”.

 

Host CPU Incompatibility

Host CPU Incompatibility

 

The solution to this issue is to enable Enhanced vMotion Capability (EVC) in your virtual cluster. Please follow following article on how to enable EVC.

 

Enabling EVC on a virtual cluster

Enabling Enhanced vMotion Capability (EVC) on a cluster when vCenter is running in a virtual machine

 

Below steps would enable Enhanced vMotion Capability (EVC) on a cluster when vCenter Server is installed on a virtual machine running in the cluster. Inorder to use EVC, you must have ESX 3.5 Update 2 or higher. Following steps will work only if the vCenter Server virtual machine is running on an ESX host that is presenting the same CPU features as the ESX host in the new EVC cluster.

 

In this scenario I have 2 ESX hosts and vCenter Server is running on one of the ESX host. Both ESX hosts are connected to a NAS and store all virtual machine data. vSphere client is used to connect to vCenter Server.  Continue reading

How to enable vMotion in VMWare ESXi Host

By default vMotion is not enabled on VMWare ESXi Host. Below shown steps will enable vMotion capability to your VMWare Virtual Host.

 

  1. Connect to your ESXi host using vSphere client.
  2. Go to Configuration page and select Networking.
  3. Click Properties for the virtual switch where a VMkernel port has been configured.
  4. Select Management Network from Ports.
  5. Select Edit and enable vMotion in General tab.
vmotion

Enable vMotion

Adding Applications to System/Notification Area in Unity (11.04/11.10/12.04)

 

If you are using Unity version of Ubuntu and you want the you favorite programe (eg. Skype) run on your systems/notification tray, try the folowing method. It’s pretty simple and safe.

Open a command prompt and run the following command.

gsettings get com.canonical.Unity.Panel systray-whitelist

You may get a following list of application already running in the system/notification tray.

[‘JavaEmbeddedFrame’, ‘scp-dbus-service’]

With the above result you can enter the following command apppending the application you require in the system/notifction tray as follows,

gsettings set com.canonical.Unity.Panel systray-whitelist “[‘JavaEmbeddedFrame’, ‘Skype’, ‘scp-dbus-service’]”

That’s it… All you require a log off the current session and log back in.