Search Windows and Linux Networking

Thursday, October 4, 2012

Installing VNC Server in Linux (CentOS)

How to install VNC server in CentOS


Install Required Packets using yum

# yum install vnc-server gnome-desktop xorg-x11-xinit xterm gnome-applets gnome-session gnome-themes gnome-panel gdm firefox dbus-x11

Set Password for VNC server user

# vncpasswd



Type new password and confirm it for accessing vnc server

Note:- To set password to user you must login with that user to create vnc password.

# vi /etc/sysconfig/vncservers

VNCSERVERS="1:root"
VNCSERVERARGS[2]=”-geometry 800×600 -nolisten tcp -nohttpd -localhost”


#service vncserver start
#service vncserver stop

#vi .vnc/xstartup

Uncomment the following two lines for normal desktop:
 
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc


# service vncserver start

It done. Now connect to vnc server from vncviewer with <IP_Address>:1


Wednesday, July 25, 2012

How to Map (Mount) NFS Share in Windows

If you wanted to use Linux NFS Share from Windows system to mount as drive. You can do it using mount command for that you need to install NFS Client for windows.

Installing NFS Client :-

If you are windows7 , Vistra, or Windows 2008 user then you can install NFS Client from Add/Remove Software wizard in the Control Panel.

If you are Windows 2000, Windows 2000 Service Pack 3, Windows 2000 Service Pack 4, Windows Server 2003, Windows XP user then you can download client from following location.
http://www.microsoft.com/en-us/download/confirmation.aspx?id=274






And the select Finish

After installation check if NFS service is running or not from service MMC

Start -> Run -> Services.msc




If require service is running on your system you can now Map (Mount) NFS share from command line using mount command:

mount servername:\Share_Name Drive_Letter

For Example: your server name is FileServer and you have NFS export /home/share and you wanted map this drive as Z: in your My computer, then command look like this:



Start -> Run -> CMD -> OK -> Mount FileServer:\home\share Z:


Mount FileServer:\home\share Z:

It will map your NFS Share in your system and it ready to access as disk drive from you my computer.

Note:- If your NFS share required Authentication you can provide it with mount command. 


 

 



Friday, March 23, 2012

VBScript for checking an Active Directory disabled users are hide in Global Address list or not.

VBScript for checking an Active Directory disabled users are hide in Global Address list or not.



Option Explicit
Dim objRootDSE,strDNSDomain,adoConnection,strQuery,adoRecordset,Field

'Check if Active Directory disabled users are hiden or not in Global Address list

wscript.echo "Searching all disabled users to check if they are hide in GAL or not please wait...."

Set objRootDSE = GetObject("LDAP://RootDSE")

strDNSDomain = objRootDSE.Get("defaultNamingContext")

Set adoConnection = CreateObject("ADODB.Connection")

adoConnection.Provider = "ADSDSOObject"

adoConnection.Open "ADs Provider"

strQuery = "<LDAP://" & strDNSDomain & ">;(&(objectCategory=person)(objectClass=user));adspath;subtree"

Set adoRecordset = adoConnection.Execute(strQuery)

' Loop through them...


Do While Not adoRecordset.EOF
     Set Field = GetObject(adoRecordset.Fields(0).Value)
     
     
     If IsArray(Field.proxyAddresses) and Field.accountDisabled = TRUE and Field.msExchHideFromAddressLists <> TRUE Then
      
       wscript.echo "Account " & Field.displayname & " is disabled but not hide in Global Address list"
          
      End If
adoRecordset.MoveNext
Loop
wscript.echo "Done"

Friday, February 24, 2012

GENERAL TROUBLESHOOTING TIPS

BLACKBERRY TROUBLESHOOTING TIPS

In following site has explain very good troubleshooting step for Blackberry Device.

for Balckberry Enterprise Activation , BES sync , Encryption Key Out of Sync and many more. I think this will help someone.


http://forums.crackberry.com/blackberry-administrators-f50/bes-troubleshooting-guide-50779/
  

Thursday, February 9, 2012

How to connect Windows Remote Desktop from Linux Step by Step


Connecting Windows Remote Desktop from Linux

If you are running Centos (Linux system) and wanted to connect Remote windows system from CentOS then you have to install rdesktop Remote Desktop Client. Using rdesktop you can easily connect Windows system from Linux. rdesktop is an open source client for Microsoft's RDP protocol. It work with Windows NT 4 Terminal Server,2000, XP, 2003, 2003 R2, Vista, 2008, 7, and 2008 R2. And it support RDP Version 4 and 5.

Installing rdesktop:-

You can download package go to http://pkgs.org  as per your distribution. Or you can install rdesktop from repository :-

For CentOS/RedHat:-

# yum install rdesktop

For Ubuntu:-

# apt-get install rdesktop

After that you are ready to access Windows Remote Desktop from terminal with following command. For more help use man command (man rdesktop)

# rdesktop <Server Name OR IP Address>

Eg:-

# rdesktop 192.168.125

Wednesday, February 8, 2012

How to Install and Configure Proftpd Server on CentOS Step by Step


Installing Proftpd Server on CentOS (Linux)
 
Proftpd is the Highly configurable GPL-licensed FTP server software .it is an enhanced, secure and highly configurable FTP server. Its configuration syntax is very similar to apache web server. You can know more information from http://www.proftpd.org .

Download proftpd rpm package from http://pkgs.org/ and install with rpm –ivh <Package name>.rpm

OR

If you want to install using yum then add repository  and then install proftpd server

#  cd /etc/yum.repos.d/
# wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
# rpm --import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
# Vi /etc/yum.repos.d/ kbsingh-CentOS-Extras.repo
Set both enable=1
# yum clean all
# yum update all

Now install Proftpd

# yum install proftpd

Now your ftp server is ready to functional  with default configuration but you should check following values for your Basic ftp server in /etc/proftpd.conf configuration file

Server Name, Server Type and Port

Now start proftpd and set on for startup

# service proftpd start
# chkconfig proftpd on

Check running process for proftpd
# ps -ef | grep proftpd
nobody    4463     1  0 23:35 ?        00:00:00 proftpd: (accepting connections)
root      4470  4202  0 23:36 pts/2    00:00:00 grep proftpd

OR you can verify whether your FTP server is running using:

# netstat -an | grep -F tcp | grep -F LISTEN | grep -F 21
tcp        0      0 :::21                       :::*                        LISTEN


Now when you try to connect ftp server it will be ask you for your name and password type valid user name and password as per /etc/passwd file . it will take you home directory of that user. 

Anonymous FTP Server :-

If you wanted Anonymous access uncomment Anonymous directive. Or you can add following in /etc/proftpd.conf file
# vi /etc/proftpd.conf

<Anonymous /var/ftp/pub>
AnonRequirePassword       off
User                                   ftp
Group                                 ftp
RequireValidShell                off
<Directory *>
<Limit WRITE>
          DenyAll
</Limit>
</Directory>
</Anonymous>


 Note: - user and group must be valid

verify configuration :-

# proftpd –t6

If it not given any error then reload configuration

# service proftpd reload

Now if you try to access FTP server it will not ask you any password and show you contain of /var/ftp/pub directory.
If you wanted to allow user to upload data then in Limit WRITE directive change it AllowAll.

Wednesday, February 1, 2012

Script to update Active Directory Database from Excel file

Script to update Active Directory Database from Excel file
Flow Chart :- 

Excel file before Update:-
Excel file after Update:-

Script :- 

'Script to update Active Directory Database from Excel file

Option Explicit
Dim strExcelPath,ObjExcel,objSheet,intRow,strUserFirstName,strUserLastName
Dim strUserTitle,strManagerFirstName,strManagerLastName
Dim adocommand, adoconnection, strBase, strFilter, strAttributes
Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strName, strCN , strGivenNAme ,strSN, strmail, strADsPath
Dim objUser,varTotalUsers,strFilter2,strQuery2,strManager,i,strValue

' Specify File.

strExcelPath = "c:\test.xls"

'Open File
Set ObjExcel = CreateObject("Excel.Application")

On Error Resume Next
objExcel.Application.Visible = True
objExcel.Workbooks.Open strExcelPath
If Err.Number <> 0 Then
  On Error GoTo 0
  Wscript.Echo "Unable to open spreadsheet " & strExcelPath
  Wscript.Quit
End If
On Error GoTo 0

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

' Start with row 2 of spreadsheet.
' Assume first row has column headings.

intRow = 2

' Read each row of spreadsheet until a blank value

Do Until objExcel.Cells(intRow,1).Value = ""

  ' Read values from spreadsheet for this user.
 
  strUserFirstName = Trim(objSheet.Cells(intRow, 1).Value)
  strUserLastName = Trim(objSheet.Cells(intRow, 2).Value)
  strUserTitle = Trim(objSheet.Cells(intRow, 3).Value)
  strManagerFirstName = Trim(objSheet.Cells(intRow, 4).Value)
  strManagerLastName = Trim(objSheet.Cells(intRow, 5).Value)
  On Error Resume Next
 
'Setup ADO Objects.
Set adocommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOobject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection

' Search entire Active Directory Domain
Set objRootDSE = GetObject("LDAP://RootDSE")

strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">" 
 
' Filter on user objects.

strFilter2 = "(&(objectCategory=person)(objectClass=user)(givenName=" & strManagerFirstName &")(sn=" & strManagerLastName&"))"
'Comma delimited list of attribute values to retrieve.
strAttributes = "sAMAccountName,cn,givenName,sn,mail,ADsPath"
'Constuct the LDAP syntax query
strQuery2 = strBase & ";" & strFilter2 & ";" & strAttributes & ";subtree"
adocommand.commandText = strQuery2
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("TimeOut") = 30
adoCommand.properties("Cache Results") = False
' Run the query
Set adoRecordset = adoCommand.Execute
' Enumerate the resulting recordset.
 If adoRecordset.Fields("sAMAccountName").Value = "" Then
     Wscript.Echo "Manager Record not found for user " & strUserFirstName & " " & strUserLastName
     ObjExcel.Cells(intRow,4).Font.Bold = TRUE
     ObjExcel.Cells(intRow,5).Font.Bold = TRUE
     ObjExcel.Cells(intRow,4).Font.Color = vbRed
     ObjExcel.Cells(intRow,5).Font.Color = vbRed
 else
 Do Until adoRecordset.EOF
   
   ' Retrieve values and display.
   varTotalUsers =adoRecordset.RecordCount
   'Wscript.Echo varTotalUsers
   If varTotalUsers = 1 Then
   strADsPath = adoRecordset.Fields("AdsPath").Value
   strValue = Split(strADsPath,"://")
   For i = 0 to Ubound(strValue)
    strManager=strValue(1)
   Next
   WScript.Echo strManager
   'Wscript.Echo "Display Name: " & strCN & ", ADsPath:" & strADsPath
   WScript.Echo "manager " & strCN & " found"
   ElseIf varTotalUsers > 1 Then
   ObjExcel.Cells(intRow,4).Font.Bold = TRUE
   ObjExcel.Cells(intRow,5).Font.Bold = TRUE
  
   End If
  'Move to the Next Record in the recordset.
  adoRecordSet.MoveNext
  Loop
  End IF

'Wscript.Echo strManagerFirstName & " " & strManagerLastName & " is manager of " & strUserFirstName & " " & strUserLastName


strFilter = "(&(objectCategory=person)(objectClass=user)(givenName=" & strUserFirstName &")(sn=" & strUserLastName&"))"
'Constuct the LDAP syntax query
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"

adocommand.commandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("TimeOut") = 30
adoCommand.properties("Cache Results") = False

' Run the query
Set adoRecordset = adoCommand.Execute

 ' Enumerate the resulting recordset.
 If adoRecordset.Fields("sAMAccountName").Value = "" Then
     Wscript.Echo "User Record not found"
     ObjExcel.Cells(intRow,1).Font.Bold = TRUE
     ObjExcel.Cells(intRow,2).Font.Bold = TRUE
     ObjExcel.Cells(intRow,1).Font.Color = vbRed
     ObjExcel.Cells(intRow,2).Font.Color = vbRed
 else
Do Until adoRecordset.EOF
   ' Retrieve values and display.
   varTotalUsers =adoRecordset.RecordCount
   'Wscript.Echo varTotalUsers
   If varTotalUsers = 1 Then
   strADsPath = adoRecordset.Fields("AdsPath").Value
   set objUser = GetObject(strADsPath)
   objUser.Put "manager", strManager
   objUser.Put "description",strUserTitle
   objUser.Put "title", strUserTitle
   objUser.Put "company", "Glam Media"
   objUser.SetInfo
   'Wscript.Echo "Display Name: " & strCN & ", ADsPath:" & strADsPath
   WScript.Echo "User " & strCN & " found"
   ElseIf varTotalUsers > 1 Then
   ObjExcel.Cells(intRow,1).Font.Bold = TRUE
   ObjExcel.Cells(intRow,2).Font.Bold = TRUE
   End If
  'Move to the Next Record in the recordset.
  adoRecordSet.MoveNext
  Loop
  End IF

' Wscript.Echo "First Name: " &  strUserFirstName & "Last Name: " & strUserLastName

       
intRow = intRow + 1

Loop
objExcel.ActiveWorkbook.Saveas "C:\updated_File.xls"
objExcel.Quit
ObjWcript.Quit

Wednesday, January 18, 2012

Install & Configure DHCP Server role on Windows 2008 Server Core

DHCP Server is very important server in the network environment. We can install & configure DHCP server role using below steps in windows 2008 server core...





1) First we will have to run below command on windows 2008 server core to add the DHCP server role.


2) Then to start DHCP service automatically, use below command...


3) Then use below command to start the DHCP service


4) If the DHCP server is in Active Directory domain environment (i.e. Member of a domain) then we must have to authorize the DHCP server to work properly.

To authorize the server in domain , use below command..


5) Now to add scope to the DHCP Server use below command


(C:\windows\system32>netsh dhcp server 192.168.127.11 add scope 192.168.127.0 255.255.255.0 scope1)

In the above command 192.168.127.11 = the IP of DHCP server

192.168.127.0 255.255.255.0 = subnet & subnet mask of scope which we have to add

Scope1 = name of the scope to be added

6) Then we will need to set the IP range for the added scope, for this use below command..


(C:\windows\system32>netsh dhcp server 192.168.127.11 scope 192.168.127.0 add iprange 192.168.127.50 192.168.127.100)

Using above command we have added IP range (192.168.127.50 - 192.168.127.100) to the scope (192.168.127.0) in the DHCP server (192.168.127.11)

7) If we want to add exclusion range to DHCP range then we have to use below command


(C:\windows\system32>netsh dhcp server 192.168.127.11 scope 192.168.127.0 add excluderange 192.168.127.56 192.168.127.60)

Using above command we have added exclusion IP range (192.168.127.56 - 192.168.127.60) to the scope (192.168.127.0) in the DHCP server (192.168.127.11)

8) To set Default Gateway (Option 003) use below command..


(C:\windows\system32>netsh dhcp server 192.168.127.11 scope 192.168.127.0 set optionvalue 003 IPADDRESS 192.168.127.1)

Using above command we have set Default Gateway address as 192.168.127.1 for the scope 192.168.127.0

9) To set DNS server (Option 006) use below command..


(C:\windows\system32>netsh dhcp server 192.168.127.11 scope 192.168.127.0 set optionvalue 006 IPADDRESS 192.168.127.10)

Using above command we have set primary DNS address as 192.168.127.10 for the scope 192.168.127.0

10) Then finally we will have to activate this scope, for this , use below command


(C:\windows\system32>netsh dhcp server 192.168.127.11 scope 192.168.127.0 set state 1)

Now your DHCP server should be running & working fine!

I hope this will help you to setup DHCP server on windows 2008 server core with ease.