RSSAll Entries in the "Operating Systems" Category

Ubuntu Remote Desktop – multiple users

When I got my new dedicated server setup with Ubuntu server 12.04 LTS, I wanted to use it both for website hosting and multiple users remote desktop work.
It took me some time to arrange all the steps to have the above completed, and as far as the hosting part was pretty easy, the multiple Ubuntu users desktop setup needed some jugs of coffee before start working as I wanted it.

So, I presume you have logged in to your server with some user already, so we will stat with updating the system:

Next, as I want all Gnome desktop features, will install it completely with:

Unity looks fancy, but I want the old Gnome panel, and I do not need “compiz”, so:

Next what we need is a VNC server.

The tricky part here is that you have to create several configuration files for the Ubuntu Remote Desktop user. This is really time consuming if you have to read all the settings and creating the files by yourself.

It is more easy to start the VNC server which will create the files automatically:

You will be asked for a password so enter it, and then kill the server as we have to make some configuration changes:

Edit the xstartup configuration file:

And make it looks like this:

Now you can start the vnc server with this:

Certainly you can change the settings if you want different Remote Desktop geometry.

Now use your preferred VNC client – http://remmina.sourceforge.net/ (Linux) and http://www.tightvnc.com/download.php (Windows) are my suggestions – and connect to the Ubuntu Remote Desktop server using x.x.x.x:2 as (:2) is the number of display used to run for the client. If you have more than one running you should use different number at the end.

As I saying different desktops, I am going to add another user to my Ubuntu Remote Desktop server.
For this I will need to repeat the above steps for creating (and starting) the VNC profile for each user. This one is not yet automatically implemented, but it is not a big deal.
First I will add another user:

Complete the several steps for creating the user which is including creating the password and user personal information.
(A little trick when you want to add user with administrative privileges is to type the command as : adduser admin
)
Then start the VNC server once to create the VNC password:

Open VNC startup file for the ‘newuser’

And paste the same configuration as for the first user:

Save the file and start the service

Now using VNC client you can connect to the new user Desktop as going to x.x.x.x:3 address.

The next step is to automate a little bit the start-up precess for these Ubuntu Remote Desktop users. Otherwise you have to start vnc4server for each user when the server is rebooted.

So, switch to root (it is just more easier) and then create vncserver folder and create file as vncservers.conf:

Inside put the following massive:

Where ‘user’ is the main user you are dealing with (the one we configured VNC for initially) and ‘newuser’ which is the second user are we have created. If you have more users created and the above steps for settings passwords and vnc4srver start-up completed, add more lines accordingly wit (:4),(:5) etc. screens.

Then create startup script for VNC server as:

And put the following lines inside:

Make the script executable, and add it to the startup scripts:

Now:

And all added users in /etc/vncserver/vncservers.conf will be able to connect via Remote Desktop.

Certainly make sure VNC ports are anebled on the firewall.

Also take in mind that VNC is alsways better to be combined with SSH tunnel as its encryption and vulnerability issues are well known.

Tags

ProFTP – Fatal: error processing configuration file ‘/etc/proftpd.conf’

This is quick one how to fix issue with ProFTPD returning this error:

Simply run :

And the issue sould be resolved.

Tags

Health check script Linux

Bellow I will present script checking Load Average on a Linux server which will send report if it becomes to high.
It is using Linux command ‘uptime’ which is pulling out server’s uptime as well as its Load Average:

In my script bellow I am using not the last minute load average, but the last five minutes (the second) one.
If you are not aware you can interpret a load average of “1.63, 0.70, 7.89” on a single-CPU system as:

– during the last minute, the system was overloaded by 63% on average (1.63 runnable processes, so that 0.73 processes had to wait for a turn for a single CPU system on average).

– during the last 5 minutes, the CPU was idling 30% of the time on average.

– during the last 15 minutes, the system was overloaded 698% on average (7.89 runnable processes, so that 6.98 processes had to wait for a turn for a single CPU system on average).

I have chosen the five minute interval as sending mails every minute is too aggressive in case of a server load. Also it could be something too short and handled by the server without notification.

* Note that some settings may need tuning because of changed/different command output

Once the script is ready you can set it as Cron. job Mine is set to check every 5th minute:

Tags

GPG error NO_PUBKEY

This quick tutorial is to show you how to fix bad GPG key or missing(deleted )GPG key on a Debian-like system.
Usually the next error appears when you try to install application or update OS with apt-get update:

GPG error: http://linux.dell.com Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY AS4433E25E3D7775

Simple resolution can be performed with the following two lines:

Take in mind to change the key with the one from your error.

Tags

Android ‘“ Detecting Internet Connection

Currently I’m working on an application which involves the network access, and one of the steps to be done is to check the internet connection.

Based on conducted researches, I found that the class responsable for querying the state of network connectivity is the ConnectivityManager. The primary responsibilities of this class are to:

Monitor network connections (Wi-Fi, GPRS, UMTS, etc.)
Send broadcast intents when network connectivity changes
Attempt to ‘fail over’ to another network when connectivity to a network is lost
Provide an API that allows applications to query the coarse-grained or fine-grained state of the available networks

We can get an instance of this class by calling Context.getSystemService(Context.CONNECTIVITY_SERVICE);

Important: Before proceeding to check the internet connection, the ACCESS_NETWORK_STATE permission must be set in the AndroidManifest file, otherwise you’ll get a security exception:

1. android.permission.ACCESS_NETWORK_STATE”

Our method of interest from this class is the getActiveNetworkInfo() method which returns an object of type NetworkInfo, through we can check if we are online or not.

The code for checking the internet connection looks like this:

1 ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
2 NetworkInfo ni = cm.getActiveNetworkInfo();
3
4 if (ni!=null && ni.isConnected())
5 Log.d(“GREC”, “connected”);
6 else
7 Log.d(“GREC”, “not connected”);

Note that it’s important to check the ni object if it’s not null, otherwise, if the connection is not available an exception is thrown.

And the last thing, in order to properly test the internet connection, disable the internet from the emulator: Settings -> Wireless & Networks -> Mobile Networks -> Data Enabled, not from you computer local area connection. This is because even if you turn off the internet from your computer, but don’t turn it off from emulator, the isConnected() method will return true.

For more information about ConnectivityManager and in general the work with network, consider this link: http://developer.android.com/reference/android/net/ConnectivityManager.html

Tags

Can not include OpenSSL headers files.

Today I had question about “..why since I have OpenSSL installed and working fine with other services, I receive such message(the bellow one) when I am trying to compile something..”

The answer is because the application you are trying to compile manually requires “openssl-devel.x” package installed. It includes files for development of applications which will use OpenSSL.
So according to your OS you should use either yum, apt-get or gpg to install it.
In my example I am trying to compile on CentOS 32 bit, so I will use yum like that:

So the next time when I try to compile my application, Openssl headers files will be there:

Tags

Windows server passive port range

Really quick one.

To set Windows server passive port range you should use adsutil.vbs which is one of the administration scripts located usually at: C:>\Inetpub\AdminScripts . I am saying usually as the Windows server installation could be on a different drive.

The issue with the Windows passive port range is that the default firewall (firewall.cpl) does not have option or field to open port range, and often when you setup FTP on your Windows server an try to connect with FTP client it may appear with error similar to this one bellow.

 

directory listing denied because of missing opened passive port range

 

As you can see from the log, you can connect to the server using FTP, but when you try to do something like listing directory content or copying files it times our. The reason is because the FTP client is trying to connect trough any opened port above 1024 one. (The usual default range is a big one. For example between 40000 and 45000)

You can add several ports manually, but if you have many FTP users, their FTP clients may exceed the port range number and will face the same issue as above. Try using this for testing purposes only (to make sure the issue is because passive port range is not set).

Manual setup of passive port range on windows firewall

 

To set passive FTP port range on a Windows server the command should be executed via the command line. So go to Start -> Run… type cmd and then:

 

The result should be similar to this one:

Passive port range sring

Once executed you should not have further issues with Passive mode using your FTP client.
 

Another method to enable Passive Port Range on Windows 2008 is to execute the following command:

 
It should return one big ‘OK’, and passive FTP access will be possible.

Set scheduled task Windows 2008

This will be basic tutorial about how to set scheduled task in Windows 2008.

First go to the Administrative Tools – Task Schedule.

 

 

Windows 2008 Scheduled tasks location

 

Once opened, you will see the Task Scheduler window. If it is not something special, you can just create basic task on your Windows 2008. Just click on the link located at right filed under actions.

 

Create basic task in the task scheduler

 

The very first step will be to set scheduled task description :

 

new task description

 

The next one will be to choose scheduled task trigger :

Scheduled Task Trigger

Windows 2008 Task Scheduler has the following trigger options you can choose from: Daily, Weekly, Monthly, One time, When the computer starts, When I log on, When a specific event is logged. All of them are self-explainable so pick the one you need. In my case the scheduled task will be on daily basis.

windows 2008 scheduled task trigger

Choose the time-frame you want the task to be executed, and then click Next for the scheduled task action:

task action

I will start simple script which will restart IIS using “iisreset” command.Use the browse button to locate the application or the script you want to be scheduled.

execute command scheduled task

The next will be to finish the task setup.

finish task configurationHere you will see the task summary, and will add the task to the Windows 2008 task schedule .

Tags

PHP relocation error

This will be quick tutorial about how to fix PHP relocation error like this one: php: symbol zlibVersion , version libmysqlclient_16 not defined in in file libmysqlclient.so.16 with link time reference. Instead php: relocation error: php: symbol zlibVersion the error could be php: relocation error: php: symbol crc32.

This is an example and the issue could happen with any shared library not only with libmysqlclient.so .

As per the error message the library version is not matching so we have to check the shared library dependencies. This can be done with tool called ‘ldd’ which prints the shared library dependencies. In this case we will check PHP for “libmysqlclient” so the command should be like this:

Or if for some reason the PHP binary is located elsewhere:

The output should be similar to this one:

Let’s check the file:

In my case this is a symbolic link to the library in the same folder:

Now let’s check if this file exist in another place.

My output is:

So there are two libraries, and now we have to check where is the missing symbol – for example zlibVersion. For that will use ‘nm’ command lists symbols from object files. Let’s try the current linked file:

The output is:

So it seams there are no symbols in this library.

With the other file:

The output is:

Which seams better.

Now I will just remote the current link:

And will create a new one with the library that contains the symbol:

This should resolve the case, and the php: symbol zlibVersion , version libmysqlclient_16 not defined in in file libmysqlclient.so.16 with link time reference error was solved.

Tags

How to disconnect (kick out) other SSH users

In this tutorial I will talk about how to disconnect SSH user from Linux remote server.

This is useful when you have stuck SSH connections or there are suspicious IPs connected to the server. If your case is the second one you may kick out the hacker from the server, but even disconnected he may have setup already backdoor or application that will return the connection to him. Anyway the first step will be to kill sshd processes serving other connection but yours.

First you will have to login to the Linux server via SSH – if you are not aware how just click on the link.

Once logged in list all current users on the server using ‘w’ command – simply type:

This will list all users on the Linux box like this:

List logged users Linux

As you can see there are several users currently logged in, and to discover which one is yours can be done comparing your IP address, what is currently doing as well as the time – for how long the users is on the server.If you are just logged in your time will be the current one on the server.

To list which user which TTY(pts) is using we have to use the Linux ‘ps’ command with extended output like this:

The output will show which “sshd” service running for which ‘pts‘ stands:

List sshd processesNow I want to kick off Linux user with pts / 4 marked on the image, and for that I will use Linux ‘kill’ command.

This will send kill signal to process 6702 which is the number for the “sshd” service with pts / 4 running on the server.
After you have executed this command try the ‘w’ command to see if the user is still logged in.

Tags