X11 Forwarding using Xming and PuTTY

We can run graphical programs on Linux machines on campus remotely and display them on your desktop computer running Windows. We can do this by using running two applications together on your Windows machine: Xming and PuTTY.

What is Xming?

Xming is a PC X Window Server. This enables programs being run remotely to be displayed on your desktop. Download and run the installation program from: http://sourceforge.net/projects/xming/

1- Navigate to the Files section and download:
*Xming setup from the Xming folder
*The fonts package installer from the Xming-fonts folder

   2- By default both programs will be installed into the same location, so don’t the worry about over writing files. We cannot work without both packages.
3- Once installed, running All Programs > Xming > XLaunch is a good idea to see what the configuration looks like. In most cases, the default options should be just fine.
4-Finally run All Programs > Xming > Xming to start the PC X Server. The “X” icon should be visible on the Windows Taskbar, as in the image below. The X Server must be started before setting up a SSH connection to a campus machine.

Xming on Windows 7 Taskbar

What is PuTTY?

PuTTY is a free SSH client. Through PuTTY we connect to a remote machine on the UT Dallas campus. Download the single Windows executable file from: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html There is no setup required, you can run by simply double clicking putty.exe.

Configuring PuTTY

1-Under Session, enter the hostname you want to connect to: 192.168.0.22 on port 22. Make sure the connection type is ssh.

putty11

 1-Next, scroll to Connection > SSH > X11. Check the box next to Enable X11 Forwarding. The remote authentication should be set to MIT-Magic-Cookie-1

2-Finally go back to Session. You can save your session too, and load it each time you want to connect.

3-Click Open to bring up the terminal and login using your netid/password .

puttyx11

Now with the ready configuration, will connect to the server.

Note: At this point it is important to log in with the User that will run the graphical interface.

display1

Run the program

 

oracle

 That is all.
Any doubts I am available.

 

Continue Reading

Join Centos in Windows Active Directory

This example shows to configure on the environment below.

Domain Server   : Windows Server 2012 R2
Domain Name    : poli01dc01
Realm                   : poli01ad01.local
Hostname            : poli01srv01.poli01ad01.local

 

Install some required packages.

yum -y install realmd sssd oddjob oddjob-mkhomedir adcli samba-common

 

Join in Windows Active Directory Domain.

# change the DNS to AD's one

[root@dlp ~]# nmcli c modify ens3 ipv4.dns 10.1.1.5

[root@dlp ~]# nmcli c down ens3; nmcli c up ens3
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)

# discover Active Directory domain
[root@dlp ~]# realm discover POLI01AD01.LOCAL

srv.world
type: kerberos
realm-name: POLI01AD01.LOCAL
domain-name: POLI01AD01.LOCAL
configured: no
server-software: active-directory
client-software: sssd
required-package: oddjob
required-package: oddjob-mkhomedir
required-package: sssd
required-package: adcli
required-package: samba-common

# join in Active Directory domain
[root@dlp ~]# realm join POLI01AD01.LOCAL
Password for Administrator:
# AD's Administrator password

# make sure it's possible to get an AD user info or not
[root@dlp ~]# id poli01srv01.poli01ad01.local\\Serverworld
uid=406801001(POLI01SRV01@POLI01AD01.LOCAL) gid=406800513(domain users@srv.world) groups=406800513(domain users@srv.world)

# make sure it's possible to switch to an AD user or not
[root@dlp ~]# su - poli01srv01.poli01ad01.local\\Serverworld
Creating home directory for serverworld@srv.world.
[serverworld@srv.world@dlp ~]$     # just switched

 If you’d like to omit domain name for AD user, configure like follows.

[root@dlp ~]# vi /etc/sssd/sssd.conf
# line 16: change

use_fully_qualified_names = False
[root@dlp ~]# systemctl restart sssd

[root@dlp ~]# id Administrator
uid=406800500(administrator) gid=406800513(domain users) groups=406800513(domain users),
406800572(denied rodc password replication group),406800518(schema admins),
406800520(group policy creator owners),406800512(domain admins),406800519(enterprise admins) 

That is all

Continue Reading

How to add New Disk in Linux CentOS 7 Without Rebooting

Increasing disk spaces on the Linux servers is a daily routine work for very system administrator. So, in this article we are going to show you some simple simple steps that you can use to increase your disk spaces on Linux CentOS 7 without rebooting to your production server using Linux commands. We will cover multiple methods and possibilities to increase and add new disks to the Linux systems, so that you can follow the one that you feel comfortable while using according to your requirements.

1) Increasing Disk of VM Guest:

Before increasing the disk volume inside your Linux system, you need to add a new disk or increase the one its has already attached with the system by editing its settings from your VMware vShere, Workstation or any other infrastructure environment that you are using.

1

2) Check Disk Space:

Run the following command to check the current size of your disk space.

# df -h

and

# fdisk -l

2

Here we can see that the total disk size is still the same that is 10 GB while we have already increased it to 50 GB from the back end.

3) Expanding Space without Rebooting VM

Now run the following commands to expand the disk space in the physical volume of the Operating System without rebooting the virtual machine by Re-scanning the SCSI Bus and then adding SCSI Device.

# ls /sys/class/scsi_host/

# echo "- - -" > /sys/class/scsi_host/host0/scan

# echo "- - -" > /sys/class/scsi_host/host1/scan

# echo "- - -" > /sys/class/scsi_host/host2/scan

Check the names of your SCSI devices and then rescan the SCSI buses using below commands.

# ls /sys/class/scsi_device/

# echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan

# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan

That will rescan the current scsi bus and the disk size that we increased from the VM guest settings will be show up as you can see in the below image.

3

4) New Disk Partition:

Once you are able to see the increased disk space inside your system then the run the following command to format your disk for creating a new partition by following the steps to increase your physical disk volume.

# fdisk /dev/sda

result:

Welcome to fdisk (util-linux 2.23.2) press the 'm' key for help
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help):

Type the ‘p’ to print the current partition table then create a new primary partition by typing the ‘n’ key and selecting the available sectors. Change the disk type to ‘Linux LVM’ by using ‘t’ command and selecting the code to ‘8e’ or leave as it to its default type that is ’83’.

Now write the table to disk and exit by Entring ‘w’ key as shown.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)

4

5)Creating Physical Volume:

As indicated above run the ‘partprobe’ or kpartx command so that the tables are ready to use and then create the new Physical Volume using the below commands.

# partprobe

# pvcreate /dev/sda3

To check the newly created volume run the following command to see if the new physical volume has been created and visible. After that we will extend the Volume Group ‘centos’ with the newly create Physical Volume as shown.

# pvdisplay

# vgextend centos /dev/sda3

5

6) Extending Logical Volume:

Now we will extend the Logical Volume to increase the disk space on it using the the below command.

# lvextend -L +40G /dev/mapper/centos-root

Once you get the successfully increased message, run the command as shown below to extend the size of your logical volume .

# xfs_growfs /dev/mapper/centos-root

The size of the ‘/’ partition has been increased successfully, you can check the size of your disk drives by using the ‘df’ command as shown.

6

7) Extending Root Partition by Adding New Disk Without Reboot:

This is the second method with but with quite similar commands to increase the size of the Logical volume in CentOS 7.

So, the first step is to Open the setting of your VM guest settings and click on the ‘Add’ new button and proceed to the next option.

7

Choose the required configuration for the new disk by selecting the size of the new disk and its type as shown in the below image.

8

Then come to the server side and repeat the following commands to scan your disk devices to the new disk is visible on the system.

# echo "- - -" > /sys/class/scsi_host/host0/scan

# echo "- - -" > /sys/class/scsi_host/host1/scan

# echo "- - -" > /sys/class/scsi_host/host2/scan

List the names of your SCSi devices

# ls /sys/class/scsi_device/

# echo 1 > /sys/class/scsi_device/1\:0\:0\:0/device/rescan
# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan
# echo 1 > /sys/class/scsi_device/3\:0\:0\:0/device/rescan

# fdisk -l

9

Once the new disk is visible run the below commands to create the new physical volume and add it to the volume group as shown.

# pvcreate /dev/sdb

# vgextend centos /dev/sdb

# vgdisplay

10

Now extend the Logical Volume by adding the disk space on it and then add it to the root partition.

# lvextend -L +20G /dev/mapper/centos-root

# xfs_growfs /dev/mapper/centos-root

# df -h

11
Conclusion:

Managing disk partitions in Linux CentOS 7 is a simple process to increase the disk space of any of your logical volumes by using the steps as described in this article. You don’t need to give your production server’s reboot for this purpose but simply rescan your SCSi devices and expand your desired LVM.

Continue Reading

How to Install OwnCloud 9.0.2 on CentOS 7 / RHEL 7

ownCloud is based on PHP and a SQLite, MySQL, Oracle or PostgreSQL database, so it can run on all platforms that meet these requirements. It provides almost all possibility of functions that are available on commercial suites; it is released under AGPLv3 license, so you can setup own cloud storage server without any additional cost.

Commercial version of ownCloud is also available.
Features:

What’s new in ownCloud 9:

It is now easier to keep ownCloud updated with the channel of your choice via the built-in Updater app and our package repositories.
ownCloud Server  brings much improved performance in the areas of syncing, file operations and dealing with parallel requests.
To make ownCloud easier to use, documentation has been massively improved and integrated in the interface.

The following are the list of features available on ownCloud.

Mobile and Desktop Syncing
Share With Anybody
External Storage
Encryption and Security
Versioning and Undelete
Activity Feed
Calendars and Contacts
Collaborative Editing
Galleries
Play Music, Watch Movies, Store Passwords

Download and Setup:

Run the following shell commands as root to trust the repository.

rpm --import https://download.owncloud.org/download/repositories/stable/CentOS_7/repodata/repomd.xml.key

Run the following shell commands as root to add the repository and install from there.

wget http://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -O /etc/yum.repos.d/ce:stable.repo
yum clean expire-cache
yum install owncloud-files

Allow apache in firewall.

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

Allow the web server to read and write the files on ownCloud directory.

chown -R apache.apache /var/www/html/owncloud/

Start Apache .

systemctl start httpd.service

Auto start the service at system start-up.

systemctl enable httpd.service

SELinux:

Set SELinux to allow OwnCloud to write the data.

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data'
restorecon '/var/www/html/owncloud/data'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
restorecon '/var/www/html/owncloud/config'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
restorecon '/var/www/html/owncloud/apps'

Extra’s:

The default maximum file size for uploads is 512MB. You can increase this limit by editing .htaccess file.

vi /var/www/html/owncloud/.htaccess

Modify the below entries.

php_value upload_max_filesize 513M
php_value post_max_size 513M

Untitled

My OwnCloud

That’s All!.

Continue Reading

How to Block Ping (ICMP) Responses in Linux System

Blocking ping responses from system can prevent system from hackers to ICMP flood dos attacks. So it can be a best practice for system security but most of online monitoring systems uses ping requests for monitoring system.
Disable Ping using iptables

You can simply block icmp responses directly from firewall in any Linux systems.

# iptables -A INPUT -p icmp --icmp-type echo-request -j DROP

Block Ping with Kernel Parameter

We can also block ping responses from system by directly updating kernel parameters. In this we can block ping responses temporarily or permanently as below.

Block Ping Temporarily

You can block temporarily block ping responses temporarily using following command

# echo "1" >  /proc/sys/net/ipv4/icmp_echo_ignore_all

Block Ping Permanently

In place of blocking ping temporarily, You can block it permanently by adding following parameter in /etc/sysctl.conf configuration file.

net.ipv4.icmp_echo_ignore_all = 1

Now execute following command to apply settings immediately without rebooting system.

# sysctl -p
Continue Reading