Tuesday, June 17, 2014

How To Transfer Files between two Debian/Linux systems

How To Transfer Files between two Debian/Linux systems

OpenSSH is a well known program which allows you to login to a host remotely, and run commands etc.

It also comes with a simple file transfer system which can be used to transfer files securely.

SCP is the command to use. You can either transfer files to the remote machine from your local one, or vice versa.

Usage is Simple :

scp file-to-send user@host:/patch/to/place/file

For example to copy the interfaces files from your local machine (ariyano to a remote server called 'arbaaz' you could use:

ariyano@ariyano:~$ scp /etc/network/interfaces ariyano@arbaaz:
ariyano@arbaaz's password:

As no destination directory was specified the file will be transferred to your home directory upon the remote machine.

If you wish to transfer a lot of tiles you can copy a directory recurisvely, with the -r flag.
-----------------------------------------------------------------

WinSCP is a fantastic windows application you could use to drag & drop files over machines.
How To Configure NIC on Debian/Linux 
for DHCP or Static IP Configuration :

In any given case you might want to change an IP configuration on a Debian/Linux system to match your network, Or you might just want the DHCP lease to take over.

**** Below is an explanation of the configuration. If you want to jump directly to the configuration, scroll below to the bottom of the page marked Configuration STEPS :

Follow the steps below and you should be up and running in no time....

In order to configure your NIC, changes have to be made to a NIC configuration file on the system.

The File is called ( INTERFACES ) 
and is located at ( /etc/network/ )

In order to open the file and make changes to it, you need a TEXT editor, to save time you can use the default editor called (nano)

The command to open the interfaces file is :

nano /etc/network/interfaces

While in the Text editor. Follow the shortcuts below.

To erase a complete line of code = ctrl + k
To save your file                = ctrl + o and then press enter
To exit the editor               = ctrl + x
(if you have not saved your file prior exiting the editor, it will ask you do to so)

Case 1 : Configuring for DHCP lease, (default). This is the default in a new installed system.

**** By Default there are two interfaces. 1. The Loopback 2. The Actual Ethernet Interface

**** Leave the Loopback as it is and we will only make changes to the Ethernet interface.

**** Leave this config as it is if DHCP is required

----------------------------------------------------------------------------
# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
----------------------------------------------------------------------------
Case 2: Configuring a Static IP
Ex: 
IP 192.168.1.200
SM 255.255.255.0
GW 192.168.1.1
DNS 192.168.1.1

**** We will only make changes to the eth0 interface and leave the loop-back as it is

auto eth0
iface eth0 inet static = Tells the system to shift the NIC in static config mode on Ethernet0
address = The IP address you wish to configure
netmask = The Subnet Mask
gateway = The Gateway

Once done your interfaces file should look something like below.
Now you need to configure your DNS in order to resolve domain names.
Follow the steps under DNS Settings.

----------------------------------------------------------------------------

This file describes the network interfaces available on your system and how to activate them.

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.1

----------------------------------------------------------------------------

DNS Settings: 

DNS setting are on a separate file all together. 

The file name is ( resolv.conf )

The file is located at : /etc/resolv.conf

To open the file type:
nano /etc/resolv.conf

----------------------------------------
nameserver 8.8.8.8
nameserver 8.8.4.4
----------------------------------------

You might not see any entries in the file, if so, type in nameserver followed by the DNS IPs.
Each new line is a alternate DNS server.

Save the file and exit the editor.

Forcing the new IP changes to take effect without restarting the server.

1. Type the command below to bring down the eth0 interface

ifdown eth0

2. Tye the command below to bring up the eth0 interface

ifup eth0

To confirm your config, Type the command below.

ifconfig

Your config should look something like this, but it could differ from system to system depending on the number of Ethernet interfaces you would have.

--------------------------------------------------------------------------------------
eth0    Link encap:Ethernet  HWaddr 00:1e:4f:be:c2:47
          inet addr:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:4fff:febe:c247/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1064060052 (1014.7 MiB)  TX bytes:824394600 (786.2 MiB)
          Interrupt:21 Memory:fe9e0000-fea00000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:297763 errors:0 dropped:0 overruns:0 frame:0
          TX packets:297763 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1233489069 (1.1 GiB)  TX bytes:1233489069 (1.1 GiB)
--------------------------------------------------------------------------------------

Configuration STEP :

1. Type ( nano /etc/network/interfaces )

2. Under ( # The primary network interface ) Type
    a. auto eth0
    b. iface eth0 inet static
    c. address xxx.xxx.xxx.xxx
    d. netmask xxx.xxx.xxx.xxx.xxx
    e. gateway xxx.xxx.xxx.xxx.xxx

3. Press ctrl+o and press enter to save and ctrl+x to exit the 
   editor

4. Type ( nano /etc/resolv.conf )

5. Type in your DNSs ( each new line is a alternate DNS server )
    a. nameserver xxx.xxx.xxx.xxx
    b. nameserver xxx.xxx.xxx.xxx

6. Presss ctrl+o and press enter to save and ctrl+x to exit the 
   editor

7. To bring down the interface
     a. ifdown eth0

8. To bring up the interface
     a. ifup eth0

Sunday, January 19, 2014

"To log on to this remote computer, you must be granted the Allow log on.."

"To log on to this remote computer, 
you must be granted the Allow log on.."

You connect to one of your 2008 server via Remote Desktop and can't log on, and you get the below error :

{ To log on to this remote computer, you must be granted the Allow log on through Terminal Services right. By default, members of the Remote Desktop Users group have this right. If you are not a member of the Remote Desktop Users group or another group that has this right, or if the Remote Desktop Users group does not have this right, you must be granted this right manually }

Cause :

Due to changes made in newer Microsoft Windows operating systems, standard limited user accounts may not be able to log in from.

Solution:

To fix this, log in as an administrator on the Host Machine, Click Start and then click Run.

Type in "gpedit.msc"

Click "OK"

When the Group Policy Object Editor appears, navigate to:

Computer Configuration > Windows Settings > Security Settings > Local Policies > User Rights Assignment

In the right-hand pane, locate the entry named "Allow Log on through Terminal Services" and double-click on it.

Click "Add User or Group.."

Type "everyone" into the available text box and click "Check Names"

After the name is underlined, click OK

Click OK


You should now be able to log in successfully on the Server terminals with any local or domain user account.

NOTE : If you are using a custom group policy then you will have to make the above changes to the Default Group Policy and not the custom policy, as the server uses the Default policy and a custom policy does not have any effect on the server itself.

Terminal Server has exceeded max number of connections !!!!

Terminal Server has exceeded max number of connections !!!!


Alright, You've got your server weather 2003 or 2008 and you're trying to get in via Remote Desktop and once you do connect, you cannot authenticate and you get the below mentioned error :

{ Terminal Server has exceeded max number of connections }

How do you get past this ? Pretty easy, follow the steps below and you should be good to go.

There are two ways to get past the above mentioned error.

1. Buy your extra licenses so you can have multiple simultaneous connections to the server

or

You already have two default connections available on your servers which you could use to get connected. Now that you only have two default connections available, you will have to kick one of the connections off if two are already connected.

How do you do that ?

Logging Off Users

Once logged into the server, (via VNC or directly accessing the server)

1. Open ‘Task Manager’
2. When the ‘Task Manager’ comes up, select the ‘Users’ tab.
3. In this window, you will see all of the users currently connected to the server.
Select a disconnected user, and then click the ‘Log off‘ button at the bottom to clear it.

Once this has been completed, log the session you are using off and you should be able to connect as normal.

Please use this session only to properly terminate the other two active sessions.

If you need any assistance with this process, or encounter any issues, please do not hesitate to get in touch.