Friday, July 4, 2014

Install Imagick on Linux

Install Imagick on CentOS, fedora or RHEL
If you are using XAMPP, Run
sudo /opt/lampp/bin/pecl install imagick
If you get any error related to /tmp/pear, it means development packages are not installed in your xampp. Download and install latest version of xampp. It comes with devel packages or find and install devel packages of your version of xampp.

If you have installed httpd/mysqld on CentOS, fedora or RHEL, Run
sudo pecl install imagick
Click here and here to resolve error.

If it installs successfully, add line 
extension=imagick.so
in the file php.ini
Restart apache. 

Install Imagick on Ubuntu or Debian
If you are using XAMPP, Run
sudo /opt/lampp/bin/pecl install imagick
If you get any error related to /tmp/pear, it means development packages are not installed in your xampp. Download and install latest version of xampp. It comes with devel packages or find and install devel packages of your version of xampp.
If you have installed apache2/mysql on Ubuntu or Debian, Run
sudo pecl install imagick
Click here and here to resolve error.

If it installs successfully, add line 
extension=imagick.so
in the file php.ini
Restart apache.

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - liblcms2.so.2: cannot open shared object file: No such file or directory in Unknown on line 0

Not able to install imagick on CentOS, fedora or RHEL
liblcms2.so.2: cannot open shared object file

Install following packages in RHEL, fedora or CentOS
yum install lcms2

mysql Error : Missing system table mysql.proxies_priv

To remove the error, run following command
sudo mysql_upgrade -u root -p
If your system does not identify mysql_upgrade, you can try these two commands.
mysqlcheck --no-defaults --check-upgrade --all-databases --auto-repair
mysql < fix_priv_tables

InnoDB: Database was not shut down normally!

mysql crashes frequently

Solution : 1
Restart your machine.

If it does not solve the problem and mysql crashes frequently with same error.

Solution : 2
Check attribute max_allowed_packet in the file my.cnf
max_allowed_packet=128M
OR
max_allowed_packet=256M

Restart mysql.
If it is not there, add it and restart mysql.

but if it does not solve the problem and mysql crashes frequently with same error.

Solution : 3
Repair all databases of mysql using following commands.
mysqlcheck --no-defaults --check-upgrade --all-databases --auto-repair
mysqlcheck --no-defaults --all-databases --fix-db-names --fix-table-names

If still your mysql crashes frequently.
Reinstall it again.

Allow / Block ssh / sftp for specific Users / Group

Allow ssh / sftp to selected users
If you want to give ssh / sftp privileges to certain users, here is the solution.
Add following line in the file /etc/sshd_config
AllowUsers username1 username2 username3
If you want to allow certain groups only, add following line in /etc/sshd_config
AllowGroups username1 username2 username3
Restart service ssh.

Block ssh / sftp for selected users
If you want to restrict certain users to access ssh / sftp, here is the solution.
Add following line in the file /etc/sshd_config
DenyUsers username1 username2 username3
If you want to block certain groups only, add following line in /etc/sshd_config
DenyGroups username1 username2 username3
Restart service ssh.

Extract an iso file in Linux using command line

Extract an iso file on terminal in Linux

Run following command
sudo mount -o loop "/path/of/iso/file.iso" /mnt
Example :
sudo mount -o loop "/home/user/Downloadsubuntu-12.04.3-desktop-i386.iso" /mnt


Now the iso file contents will be mounted in /mnt
You can copy them anywhere.
sudo cp -r /mnt /your/desired/destination/directory
Example :
sudo cp -r /mnt /home/user/Documents/files


If you do not want to use command line, you can extract it using Archive Manager.
Right click on the iso file and select "Extract here'.
If you have Archive manager, you can mount it using Archive Mounter and files will be opened as separate drive.


Monday, June 2, 2014

Postfix - Change Sender's email address from root

When you send mail using Postfix through command line or similar way, it shows sender's e-mail address root@domain-name. You do not want this and you want your defined email should be visible in recipient's mailbox. Follow the steps.

Add following line in the file /etc/postfix/main.cf 
smtp_generic_maps = hash:/etc/postfix/generic
Now edit the file /etc/postfix/generic, if it is not there, create it.
Add your 'from address' and 'the address you want to be seen in place of from address' in this file.
Example :
root@domain.com linuxamination@gmail.com
user1@domain.com linuxamination@gmail.com
You can define different mail addresses for each user of Linux. 
Now Run following commands in terminal.
postmap /etc/postfix/generic
and
service postfix restart
Now it displays linuxamination@gmail.com as sender, when I send mail as a root or user1.
echo "content-of-the-mail" | mail -s "subject-of-the-mail" "recipient@mail-address.com" 

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable ERROR: `phpize' failed

Install autoconf on your Linux system.

If you are using Debian or Ubuntu, Run
sudo apt-get install autoconf
If you are using CentOS or RHEL or fedora, Run 
sudo yum install autoconf

httpd dead but pid file exists

Your Apache is not working because it gives following error :
httpd dead but pid file exists

You have tried to restart Apache several times but still it gives same error.
To remove this error, you need to remove Semaphore Arrays of Apache.

Find all Semaphore Arrays of Apache. Run following command in terminal.
ipcs -s | grep apache
Now remove each entry using command
ipcrm -s semid
semid is second column of the table.

If there are multiple entries of Apache and it is difficult to remove each entry individually, Run following command.
for i in `ipcs -s | grep apache | awk '{ print $2 }'` ; do ipcrm -s $i ; done;
If it is not working for you, Run
ipcs -s | grep apache |  perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
Now restart Apache. Run following command.
service httpd restart 

Solution : 2
If still you are facing same error after restarting Apache. Run
rm /var/lock/subsys/httpd
and Run
rm /var/run/httpd/httpd.pid
Now restart Apache again.
service httpd restart 
Now what is Semaphore Array
A semaphore is a variable or abstract data type that is used for controlling access, by multiple processes.
In its simplest form a semaphore is a location in memory whose value can be tested and set by more than one process. 
ipcs  provides  information on the ipc facilities for which the calling process has read access.
-s displays semaphore arrays.
ipcrm removes a message queue, semaphore set or shared memory id.

Tuesday, May 20, 2014

code 127 --> sh: /usr/bin/expect: not found

 sh: /usr/bin/expect: not found

Install expect on your Linux system.

If you are using ubuntu or debian, Run
sudo apt-get install expect

If you are using CentOS, fedora or RHEL, Run
sudo yum install expect

ftp server vsftpd - Allow root login

 
By Default, root is not able to access ftp because it's name in the list of /etc/ftpusers or /etc/vsftpd/ftpusers
Remove root from the list. Save the file.
Restart vsftpd.
root will be able to log-in using ftp.

If you are using CentOS, fedora or RHEL and still you are not able to log in as root in your ftp server.
Add following line in the file vsftpd.conf
userlist_deny=YES
Remove user root in file /etc/vsftpd/user_list 
Restart vsftpd.
root should be able to log-in using ftp.
 
You can see the solution in the following video.
 


Friday, May 16, 2014

Open XAMPP control Panel - A GUI interface

XAMPP Control Panel - A GUI Interface

If you do not want to start/stop/restart xampp using command line, you can do it using UI interface. Just click on the button and your service will be started/stopped.

If you are using new XAMPP
To open XAMPP's control Panel (GUI interface), Run following command.
cd /opt/lampp && sudo ./manager-linux.run
If you are using older versions of XAMPP, Run following command.
gksu /opt/lampp/share/xampp-control-panel/xampp-control-panel

You can create launcher for this command. Whenever you run the launcher, it launches the XAMPP control panel.

Install XAMPP using command line on Linux

Install XAMPP using command line on Ubuntu, CentOS, Fedora, Debian, RHEL

If you are installing xampp first time on your linux system then it is fine but if you have installed it before and there is directory lampp in your /opt. You should rename it first.
# mv /opt/lampp /opt/lampp_old
Now download xampp installer from here.
A file xampp-linux-version-number-installer.run will be downloaded.
Suppose it is in directory Downloads.
Make the file executable.
# chmod a+x ~/Downloads/xampp-linux-version-number-installer.run
Now run the file.
# cd ~/Downloads
# ./xampp-linux-version-number-installer.run
It will open the wizard, now complete it to install xampp.


 





Now when you click on finish button, XAMPP's GUI interface will be appeared.


Now you can start/stop Apache & mysql using UI interface. Click on 'Manage servers' and you will be able to start/stop servers using buttons.

Open xampp in Browser
http://localhost/xampp

Open XAMPP control panel / GUI interface
Run following command in terminal
# cd /opt/lampp && sudo ./manager-linux.run




X11 connection rejected because of wrong authentication

If you are not able to log into Linux user account using ssh and you are getting this error, here is the solution.

Open the file etc/ssh/ssh_config on your system , client side (NOT on the server where you want to connect)

Check this parameter in the file
ForwardX11 yes
It should be uncommented as well as set as yes.

Restart ssh on your system. Try to connect again.

If you are still getting this error, open the file /etc/ssh/sshd_config server side where you want to connect.

Check this parameter in the file
X11Forwarding yes
It should be uncommented as well as set as yes.

Saturday, April 26, 2014

Fatal error: ini_set(): To prevent data corruption, you are not allowed to turn on the mongo.native_long setting on 32-bit platforms in Unknown on line 0

It is a mongo client - RockMongo error.

To remove the error, open file index.php in the directory rockmongo and comment the line
ini_set("mongo.native_long", 1);
Make it two forward slashes at the starting of the line to comment it out.
// ini_set("mongo.native_long", 1);
Now try again.

The default username and password is admin

You may find some deprecated error here but you can use the RockMongo without fatal error.

Tuesday, April 15, 2014

Install nodejs or node.js on CentOS / RHEL / fedora

To install node.js ( nodejs ) on CentOS / RHEL / fedora, Run following commands.

# sudo yum install nodejs

Install Packages using npm on CentOS / RHEL / fedora
First install npm on centos / RHEL / fedora
# sudo yum install npm
Now install packages using npm
Install mongodb :
# npm install mongodb
Install express :
# npm install express

Install nodejs or node.js on ubuntu

To install node.js ( nodejs ) on ubuntu, Run following commands.

# sudo add-apt-repository ppa:chris-lea/node.js

# sudo apt-get update

# sudo apt-get install nodejs

# sudo apt-get install software-properties-common

Install Packages using npm on Ubuntu
First install npm on ubuntu
# sudo apt-get install npm
Now install packages using npm
Install mongodb :
# npm install mongodb
Install express :
# npm install express

XAMPP - Fatal error: Class 'ZipArchive' not found

Run following command to download file zip.so
# /opt/lampp/bin/pecl install zip
It will install zip functionality, now enable the extension zip.so

To Enable this, uncomment following line (remove the semi colon (;) )
extension="zip.so"
in the file /opt/lampp/etc/php.ini

Restart xampp.

phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

CentOS - If you are getting this error while executing phantomjs on terminal

phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
 
To remove this error.

# sudo yum install fontconfig
If you are still facing the error, Run
# sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6
Note :
If you are using ubuntu or debian, use apt-get install to install this package.

phantomjs: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory

CentOS - If you are getting this error while executing phantomjs on terminal

phantomjs: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory
 
To remove this error.

# sudo yum install freetype
If you are still facing the error, Run
# sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6
Note :
If you are using ubuntu or debian, use apt-get install to install this package.

Install phantomjs on Linux

Install phantomjs on Ubuntu / Debian

Download phantomjs package from here

If you have 32 bit Linux distribution, download 32 bit file package or if you are using 64 bit Linux distribution, download the 64 bit package.

Extract the zip file and open the directory. Now you will find the phantomjs file inside bin directory.

Copy the file and paste into /usr/bin, /usr/local/bin & /usr/local/share.

Create a file hello.js and put following code into it.


console.log('Hello, world!');
phantom.exit();
Now run the phantomjs from the terminal.
# phantomjs /path/of/hello.js or # /usr/bin/phantomjs /path/of/hello.js

Install phantomjs on CentOS / RHEL

Download phantomjs package from here

If you have 32 bit Linux distribution, download 32 bit file package or if you are using 64 bit Linux distribution, download the 64 bit package.

Extract the zip file and open the directory. Now you will find the phantomjs file inside bin directory.

Copy the file and paste into /usr/bin, /usr/local/bin & /usr/local/share.

Create a file hello.js and put following code into it.
console.log('Hello, world!'); phantom.exit();
Now run the phantomjs from the terminal.
# phantomjs /path/of/hello.js or # /usr/bin/phantomjs /path/of/hello.js
If you get the error
phantomjs: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory

 
To remove this error.

# sudo yum install freetype

Now run hello.js again but if you get another error
phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

 
To remove this error.

# sudo yum install fontconfig
 If you are still facing the error, Run
# sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6
Now run again, it should work.

# phantomjs hello.js Hello, world!
Note : 
Execute or Run phantomjs on browser
you can't directly reference a phantomjs script in your browser, but you can communicate with a PhantomJS instance using HTTP GET/POST with Web Server module

Monday, April 14, 2014

ERROR:dbus.proxies:Introspect error on :1.303:/org/freedesktop/PackageKit: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken

Open file /etc/dbus-1/system.d/org.freedesktop.PackageKit.conf
Find the line
<allow send_interface=org.freedesktop.PackageKit"/>
Add following line after above line
<allow send_interface="org.freedesktop.PackageKit.Transaction"/>

Open file /etc/dbus-1/system.conf
Find both lines
<allow send_requested_reply="true" send_type="method_return"/>
<allow send_requested_reply="true" send_type="error"/>

and replace top line with following line
<allow send_requested_reply="true"/>
Now delete the bottom line.

XAMPP Error- (20014)Internal error: Error retrieving pid file logs/httpd.pid Remove it before continuing if it is corrupted.

If you are getting above error, Remove file httpd.pid from /opt/logs/httpd.pid
Restart XAMPP.

Open video in Linux terminal in ASCII mode

If you want to open the video in Linux terminal, follow the steps.

They are not viewable but if you are Linux Geek, only you can understand the experience.

If you are using ubuntu / debian / mint, Install following package first.
# sudo apt-get install mplayer
Now play the video using terminal
# mplayer -vo caca "/path/of/the/video/.avi"

If you are using CentOS / RHEL / fedora, Install following package first.
# sudo yum install mplayer
Now play the song using terminal
# mplayer -vo caca "/path/of/the/video/.avi"

Play songs using Linux Terminal


If you want to play the songs using Linux command line, follow this.

If you are using ubuntu / debian / mint, Install following package first.
# sudo apt-get install mpg321
Now play the song using terminal
# mpg321 "/path/of/the/song.mp3"

If you are using CentOS / RHEL / fedora, Install following package first.
# sudo yum install mpg123
Now play the song using terminal
# mpg123 "/path/of/the/song.mp3"

ubuntu - E: Could not perform immediate configuration on 'util-linux'. Please see man 5 apt.conf under APT::Immediate-Configure for details. (2)

If you are facing this error on your ubuntu or debian system. Run following commands.
# sudo apt-get upgrade -y

# sudo apt-get install upstart-job

# sudo apt-get dist-upgrade -y

Ubuntu - E: Package has No installation candidate

If you are facing this error on ubuntu, Run following command.
# sudo apt-get update

Postfix - master dead but pid file exists

Stop and start postfix. Do not restart, use individual commands for stop & start.

If you are still facing the problem
Remove /var/spool/postfix/pid/master.pid and /var/lock/subsys/postfix
Stop and start postfix

If you are still facing the problem, Check what is running on port 25
# netstat -lnp | grep :25
Kill the process and start postfix again.

ubuntu - Compiler error - msgfmt command not found

Install following package
# sudo apt-get install gettext
or

use '-i' while installing package from source code.
make -i install

ubuntu - configure: error: zlib.h was not found or is not usable. Please install zlib

Install these packages, libgcrypt11-dev and zlib1g-dev
# apt-get install libgcrypt11-dev

# apt-get install zlib1g-dev

Starting httpd: [date] [warn] _default_ VirtualHost overlap on port 80, the first has precedence

To remove this error, uncomment following line in /etc/httpd/conf/httpd.conf

NameVirtualHost *:80
Now restart httpd
# service httpd restart

Apache - Browser throwing sql query and php code

Apache - Browser showing mysql queries and php code

Open php.ini file
Find "short_open_tag = Off" and make it enabled
short_open_tag = On
Restart Apache. If you are using xampp, restart lampp after making changes in php.ini


If you are using xampp and you are still facing this problem.
Uncomment following line in the file /opt/lampp/etc/httpd.conf
Include etc/extra/httpd-xampp.conf
This line should not be commented.

If you are using centos / RHEL / fedora and you are still facing the problem
Run following command in the terminal.
# yum install php php-mysql -y

ubuntu - could not perform immediate configuration on 'python-minimal'

If you are facing this error, Run the following command in the terminal
# sudo apt-get -f install -o APT::Immediate-Configure=false

CentOS / RHEL / fedora - Apache error - include() unable to allocate memory for pool

Add line in httpd.conf
php_flag apc.cache_by_default Off

Add line in php.ini
apc.enabled = 0

Restart httpd

# service httpd restart

HP laptop / notebook - show wired and wireless connections simultaneously


Wireless connections are disappeared after connecting to LAN

Press F10 before booting and open the BIOS mode

System Configuration > Built in settings

Disable the option LAN/Wireless switch
The option should not be enabled.

Save the changes and exit.

Now you can see wired and wireless connections together.

Fatal error: Call to undefined method PMA_Config::load() in /usr/share/phpmyadmin/libraries/Config.class.php

 Solution :

Restart apache and mysql both.

If you are using XAMPP - Restart it.
# /opt/lampp/lampp restart
It will restart apache and mysql both.

If you are using apache2 - restart it using
# service apache2 restart
If you are using apache2 - restart it using
# service mysql restart
If you are using httpd - restart it using
# service httpd restart
If you are using mysqld - restart it using
# service mysqld restart

See the Mail Queue and Delete all pending mails on Linux server

List the Pending mails and delete them on Linux Mail Server

If you want to see all the pending mails on your Linux server, Run following command:
# mailq
If you want to delete all these pending mails, Run
# postsuper -d ALL

Saturday, March 8, 2014

phpmyadmin - Database imported successfully but tables are not visible

phpmyadmin not showing tables

List the views in the database using following query
SHOW FULL TABLES IN database_name WHERE TABLE_TYPE LIKE 'VIEW';
Just edit the database_name in above query, it will list all the views of database.
Remove all the views.

Now the tables will be visible.

ubuntu/debian - Temporary failure resolving ‘sites in sources.list’

ubuntu/debian - Temporary failure resolving ‘sites in sources.list’

If you are trying to download packages using terminal and you are facing this error, check these things first.

If you are using proxy, proxy address should be defined in these files.
1) check /etc/apt/apt.conf file for proxy
2) check /etc/environment file for proxy


If you are not using proxy, make sure proxy settings should be removed from above files.

If above files are according to requirement and you are still facing this problem, try this solution.

Open file /etc/resolv.conf, add following line in the file and save it.
nameserver 8.8.8.8

8.8.8.8 is google's public DNS address.


Now restart networking and try to install packages again.

Centos - 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

Centos - 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

If you are trying to download packages using terminal and you are facing this error, try this solution.

Open file /etc/resolv.conf, add following line in the file and save it.
nameserver 8.8.8.8

8.8.8.8 is google's public DNS address.


Now restart networking and try to install packages again.

Saturday, February 8, 2014

/usr/bin/env: php: No such file or directory

/usr/bin/env: php: No such file or directory

If you are getting this error, It means you do not have certain packages.
You need to install them.

If you are using Ubuntu / Debian or any apt based Linux distribution,
Run following command.
$ sudo apt-get install php5-cli
If you are still facing this problem, try to install these packages.
$ sudo apt-get install php5
and
$ sudo apt-get install libapache2-mod-php5

If you are using Fedora / CentOS / RHEL,
Run following command.
$ sudo yum install php-cli
If you are still facing this problem, try to install this.
$ sudo yum install php

Friday, February 7, 2014

Bash crontab not found

Bash crontab not found

If you are using CentOS / Fedora /RHEL
$ sudo yum install vixie-cron
If you are using Ubuntu / Debian
$ sudo apt-get install cron

Ubuntu - no wireless extensions / No wireless connections appeared to enable

Ubuntu - no wireless extensions

If you are using ubuntu and you have enabled wireless network, your wireless is working fine for other devices but ubuntu does not show wireless connections.

If you run command iwconfig in terminal and it shows no wireless extensions.

Here is solution for you.

Install following packages in your ubuntu. Run the command in terminal.
$ sudo apt-get install b43-fwcutter firmware-b43-installer
Restart ubuntu. Now you should be able to see wireless connections in notification area.
Run command iwconfig.

Note : Check if a wireless card has been implemented in your system.
# lspci | grep "Network controller" 
If there is no output, it means it is not implemented yet.

Thunderbird - No signature in your forward / reply emails

Thunderbird - Add signature in your forward / reply emails

Open  Composition & Addressing in Thunderbird.
Edit > Account Settings > Composition & Addressing
Now check these two options.

  • Include signature for replies
  • Include signature for forwards
Now your signature will be appeared in your replies and forwards.

Thunderbird Error - Your thunderbird profile cannot be loaded. it may be missing or inaccessible

Your thunderbird profile cannot be loaded. it may be missing or inaccessible



To remove this error, open .thunderbird directory inside your home directory.
# cd ~/.thunderbird
Now remove file profiles.ini
# rm profiles.ini
Restart Thunderbird.

Saturday, January 11, 2014

Mysql database back up using source directory

Mysql database recovery using source directory

If you do not have .sql file of your mysql database, it doesn't mean you can not deploy the database on the server. If you have source directory of mysql database, it is quite fine to recover database.

Here is the path of source directory of mysql databases :
If you are using xampp, the path is /opt/lampp/var/mysql
If you are using default mysql, the path is /var/lib/mysql

In source directory, it saves the data as .frm files.

If phpmyadmin is not opened because of corrupt mysql packages (re-installation is not possible) and command line mysql is not working, now it looks like your all databases are gone but if source directory is fine, every thing is fine.

Keep back up of this source directory.

Now if you want to shift the databases on other system, just copy source directories of databases and put into mysql source directory of other system. Now you will try to see these databases in phpmyadmin or using command line but it doesn't show any data.

Here is the most important part, it does not show data because of wrong owner and permission. You need to set it correct.
# sudo chown -R mysql:mysql /opt/lampp/var/mysql/new-database-dir
Now set owner and group both mysql for this new directory.
# sudo chown -R mysql:mysql /var/lib/mysql/new-database-dir
(according to your mysql)

Set the permission 755(maximum open) for the new directory, you can set little less according to security of your network.

# sudo chmod -R 755 /opt/lampp/var/mysql/new-database-dir
or
# sudo chmod -R 755 /var/lib/mysql/new-database-dir
(according to your mysql) 

Note : This is one of the efficient way to deploy mysql database without using .sql file. Just put this mysql database directory(containing .frm files) in source directory of mysql, set the proper owner and permission and your mysql database is deployed.

Ubuntu - Linux - E: Package has No installation candidate

E: Package has No installation candidate

This is one of the common Ubuntu error you get while installing new packages.
If you are getting it for any specific package then you should update your apt repository by adding this package.

But if you are getting this error for every package, here is the solution.

Run following command.
# sudo apt-get update
Now try to install the package again, you should not get the error.

Find the public IP address of the system using command line

Commands to find Static IP address of the server

If you want to find the public IP address of the system. Run following commands.
# wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
If this is not working for you, try this.
# curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
It does not show you the LAN IP address, it shows the IP address that you can access out side the LAN, if it is static.
# curl ifconfig.me
One of these four should work for you.
# lynx -dump ifconfig.me | grep 'IP Address'

No write since last change (use ! to override)

No write since last change (use ! to override)

If you are getting this error after using :q while saving your changes in command line editor.
Run following commands
:w
then
:q
Now it will ask to save the changes.

Tuesday, January 7, 2014

X11 forwarding request failed on channel 0

X11 forwarding request failed on channel 0
Error: no display specified

If you are facing this error while connecting remote server through ssh -X, see the post below.

When you try to open display of remote server on your system, you may get this error.

To remove this error, follow the solution.

Solution :

1) Open file /etc/ssh/sshd_config on remote server where you want to connect.

2) The following attribute must be uncommented in the file as well as set as yes.
X11Forwarding yes
Now restart ssh/sshd and try to connect to the server.

3) If X11Forwarding has been set as yes in the file and it is still showing same error, Find the following attribute in the file, uncomment it and set it no.
X11UseLocalhost no
4) Now restart ssh/sshd and try to connect to the server.
service ssh restart
or
service sshd restart
According to your Linux Distribution.

If you are still facing the problem after restarting ssh service, check there is a file .Xauthority in home directory of server.
If it is not there create it using following command.
First log in to the server command prompt using ssh and run following command there.
mkxauth -c
Now restart ssh/sshd and try again.