Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


[TUTORIAL] How To Setup VNC Server Linux For Remote Desktop ur Machine
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

[TUTORIAL] How To Setup VNC Server Linux For Remote Desktop ur Machine

XTonyXTony Member
edited April 2016 in Tutorials

This Tutorial Worked Fine For Centos Any Version

1 Installation

From the root ssh we gonna install VNC-server.

first install desktop package

yum groupinstall Desktop

Further install

yum install gnome-core xfce4 firefox

yum install tigervnc-server

Now make the service on after every reboot

chkconfig vncserver on

==============

3 Adding VNC user

For security reasons i suggest add new vnc user..

Or u can Still using user=root
if want keep using root for vnc user
just skip the Adding VNC user part below and go directly to vnc password set and continue to the configuration part

vncpasswd


In my case I am i will use new user for vnc.
user=XTony it will differ in your case. You can use any username for the same.

useradd XTony

Now I will assign the vncpassword for the user with the user I just created before as:

su - XTony

vncpasswd

the output:

[root@server1 ~]# su - XTony

[XTony@server1 ~]$ vncpasswd

Password:<--yourvncpassword

Verify:<--yourvncpassword

[XTony@server1 ~]$

===============

Now I will make the configuration file for the vncserver by creating file as follows:

nano /etc/sysconfig/vncservers

at the last two line of the file uncomment it and give the entries like this.

[...]

VNCSERVERS="1:XTony"

VNCSERVERARGS[1]="-geometry 1024x768"

Here your port comes to be 5901 & 1024x768 resolution for the VNC client, you can choose resolution of your own choice.

===============

Now I will restart the VNC server service as root user:

service vncserver restart

=================

output :

[root@server1 ~]# service vncserver restart
Shutting down VNC server: [ OK ]
Starting VNC server: 1:XTony xauth: creating new authority file /home/XTony/.Xauthority

New 'server1.example.com:1 (XTony)' desktop is server1.example.com:1

Creating default startup script /home/XTony/.vnc/xstartup
Starting applications specified in /home/XTony/.vnc/xstartup
Log file is /home/XTony/.vnc/server1.example.com:1.log
[ OK ]
[root@server1 ~]#

==================

If you need any help post below.

GBSSDVPS.COM

Thanked by 1aglodek
«1

Comments

  • Interesting, thanks :) Any recommendations re VNC client to use on Windows…?

  • XTonyXTony Member
    edited April 2016

    @aglodek said:
    Interesting, thanks :) Any recommendations re VNC client to use on Windows…?

    yes do you from windows to other machine or from machine to windows
    if you mean from windows to linux : u can use TigerVNC

    windows to windows : not need to install anything just make sure remote desktop option is activated in your destination windows and use remote desktop conection .

    Thanked by 1aglodek
  • aglodekaglodek Member
    edited April 2016

    @Xtony said: yes do you from windows to other machine or from machine to windows if you mean from windows to linux : u can use TigerVNC

    Sorry for not being clear: I was asking about windows to linux box, after setting it up following your tutorial… thanks.

  • @XTony said: (…) Here your port comes to be 5901 & 1024x768 resolution for the VNC client, you can choose resolution of your own choice.

    Can the port be changed as well? And how to do that? (e.g. for use on a NAT VPS)

  • XTonyXTony Member
    edited April 2016

    @aglodek said:
    Can the port be changed as well? And how to do that? (e.g. for use on a NAT VPS)

    through an ADSL router that performs NAT, i.e. all the PC's have subnet
    IP

    addresses (10.0.0.X), which means they cannot be accessed as such from a
    remote VNC client through the Internet.

    I know the public IP address of the router, but haven't found anything
    on how
    to build an IP address for individual PC's in the LAN (the ones running
    VNC
    servers) that can be addressed from a remote VNC client.

    OK, this is an expanded answer to the one I gave somebody else

    asking about VNC'ing to a server behind NAT. I assumed that

    they had control of the NAT, I didn't realise that some ISPs

    NAT'd people's connections.

    So, I'm assuming that this is your setup (xDSL with home router):

    (fixed font for this, folks)

                         ________
                        /        \
                        |  xDSL  | 
    
    POTS-----| ROUTER |----ethernet------PC1 (10.0.0.1)
    
                        | a.b.c.d| 
    
                        |        |----ethernet------PC2 (10.0.0.2)
    
                        |        | 
    
                        |        |----ethernet------PC3 (10.0.0.3)
    
                        \________/
    

    In this example, the router has an IP address a.b.c.d (static, I

    assume -).

    Since the router is the only one

    with a 'proper' (ie, public - ie, addressable through the internet)

    IP address, you can only connect your VNCviewer to ports on this

    router.

    lets say you want to connect your viewer to

    port 5900 on PCs 1,2 & 3.

    So you need to forward 3 ports on the

    router to port 5900 on PC1,2 & 3.

    So, go into your router config, find 'port forwarding' (this may

    be called something else - anyone seen a different term for this?)

    and setup (for example)

        forward router port 5901 -> 10.0.0.1:5900
    
    
        forward router port 5902 -> 10.0.0.2:5900
    
    
        forward router port 5903 -> 10.0.0.3:5900
    

    ....so you can now connect via the internet to your PCs using

    vncviewer, and connecting to a.b.c.d:1 will give you PC1,

    a.b.c.d:2 will give you PC2 etc.

    Does that make sense? Post the model of your router and somebody

    can probably give you the exact details of the port forwarding

    config.

    Thanked by 1aglodek
  • XTonyXTony Member
    edited April 2016

    @aglodek said:
    Interesting, thanks :) Any recommendations re VNC client to use on Windows…?

    iam testing this tutorial for windows 8 to centos 6 and work as well without xrdp server (i dont recommend it for windows just install vnc server directly)

    just after install vnc server on ur target machine eg:179.125.123.2

    then install tigervnc in your windows machine

    and connect to your target machine (for example)

    179.125.123.2:5901

    i using 5901 because the port spefied in my configuration is 1 as below:

    VNCSERVERS="1:XTony

    if i locate it to "3" as below

    VNCSERVERS="3:XTony

    then i will connect to

    179.125.123.2:5903
    `

    Thanked by 1aglodek
  • Weren't you suppose to open ports 5901 to allow remote connections?...

  • @XTony, you have a very nice website. Which web designer did you use?

    Thanked by 2Dylan MikePT
  • @serverian

    OMG! So true!

    And nice to see you btw =)

  • aglodekaglodek Member
    edited April 2016

    @XTony said: (…) OK, this is an expanded answer to the one I gave somebody else asking about VNC'ing to a server behind NAT. I assumed that they had control of the NAT, I didn't realise that some ISPs NAT'd people's connections…

    ↑ this! I'd asked whether it would be possible to change the port on which the VNC server listens, so that I could choose one of the ports already allocated to my NAT'd VPS by my provider (where I have no control over this, but have the list of randomly allocated ports to choose from).

    Seems I'd correctly assumed the VNC client could be manually configured accordingly to use the chosen port, so no problem at the client (Windows) end.

  • XTonyXTony Member

    @serverian said:
    XTony, you have a very nice website. Which web designer did you use?

    Actually iam the designer

  • @XTony said:
    Actually iam the designer

    Nice skills there! Can I hire you to design my websites as well?

  • XTonyXTony Member

    @noaman said:
    Weren't you suppose to open ports 5901 to allow remote connections?...

    you dont need to open the port

    @aglodek said:
    Seems I'd correctly assumed the VNC client could be manually configured accordingly to use the chosen port, so no problem at the client (Windows) end.

    for Nat users
    the idea it not change the Vnc port
    but forward a port to the vnc port as specified before

    Thanked by 1aglodek
  • XTonyXTony Member

    @serverian said:
    Nice skills there! Can I hire you to design my websites as well?

    i have no probleme let me check it first

  • DylanDylan Member
    edited April 2016

    serverian said: @XTony, you have a very nice website. Which web designer did you use?

    This tutorial is copied almost word for word too.

    https://www.howtoforge.com/vnc-server-installation-centos-6.5

  • @XTony said: for Nat users the idea it not change the Vnc port but forward a port to the vnc port as specified before

    Yep, that works :) Can use iptables for that. This said, it adds to complexity with no added utility. Would be more elegant to simply set the port(s) in the VNC server config.

  • XTonyXTony Member

    @aglodek said:
    Yep, that works :) Can use iptables for that. This said, it adds to complexity with no added utility. Would be more elegant to simply set the port(s) in the VNC server config.

    yep u can use iptable:

    just open

    /etc/sysctl.conf

    and make sure the following line is enabled, and set to "1":

    net.ipv4.ip_forward = 1
    

    Save the file, then run:

    sysctl -p
    

    Configure IPTables;

        iptables -A FORWARD -d 2.2.2.2 -i venet0 -p tcp -m tcp --dport 5901:7705 -j ACCEPT
    

    change the

    2.2.2.2 = to target machine

    venet0 = Ethernet adapter

    7705 = target Nat port

    forward to

    5901 = vnc port

    **Step Two
    **

    iptables -t nat -A PREROUTING -d 1.1.1.1 -p tcp -m tcp --dport 5901:7705 -j DNAT --to-destination 2.2.2.2

    1.1.1.1 = root server

    Step Three

    iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE

        service iptables save
        service iptables reload
    
    Thanked by 1aglodek
  • madtbhmadtbh Member
    edited April 2016

    @serverian said:
    XTony, you have a very nice website. Which web designer did you use?

    ** cough * backupsy.com * cough*

  • KamAKamA Member, Host Rep

    @madtbh said:
    ** cough * backupsy.com * cough*

    It gets better: https://i.kamranali.uk/0d14f93d878bc084d378.png

    Until earlier the logo was also that of Asura Hosting

  • AmitzAmitz Member
    edited April 2016

    XTony said: Actually iam the designer

    Actually you are not.
    Could you please clarify why you are using a ripped version of backupsy.com's design for your site? And why are you posting ripped tutorials? I am really looking forward to your "explanation".

    Thanked by 1yomero
  • madtbhmadtbh Member
    edited April 2016

    I've spoken to Alex Wacker at Backupsy. He is looking into it.

    @Amitz said:
    Could you please clarify why you are using a ripped version of backupsy.com's design for your site? And why are you posting ripped tutorials? I am really looking forward to your "explanation".

    @XTony

    Thanked by 1Amitz
  • DylanDylan Member
    edited April 2016

    madtbh said: I've spoken to Alex Wacker at Backupsy. He is looking into it.

    Oh, I think they know! @serverian = Oktay Kilic, Backupsy's owner :)

  • IshaqIshaq Member

    Hosting at OVH.

    IP 51.255.37.230

    [email protected]

  • AmitzAmitz Member

    He is also displaying fake testimonials on his site and claims that they originate from WHT and LET... :-) Not to mention the very funny "HARRY UP!" in his header.

  • XTonyXTony Member

    i just starting in the service before 3 days so dont show me as a scam

  • XTonyXTony Member

    i will change the design soon

  • dailydaily Member

    Maybe he needs a 3 day ban then? ;)
    @Amitz @Ishaq

  • FlamesRunnerFlamesRunner Member
    edited April 2016

    Off-topic: When did you become an administrator @Ishaq? Congratulations anyway!

    Thanked by 3Ishaq daily badpatrick
  • DylanDylan Member
    edited April 2016

    @Amitz said:
    He is also displaying fake testimonials on his site and claims that they originate from WHT and LET... :-) Not to mention the very funny "HARRY UP!" in his header.

    Good news! He changed the color of the site from blue to green. That makes it totally original, right?

    Also no more "HARRY UP!" :(

Sign In or Register to comment.