Authorizing a new user to connect to X server

I have red hat linux loaded in my PC.

Can someone please let me know the command used to authorize a new user to connect to X server.

Regards & Thanks,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

By default, RedHat should allow a new user to run "startx" if you have added that new user with the "adduser" (or "useradd") command (as root) and assigned a password  with the "passwd" command.
I believe startx is a script (or a executable) that falls under normal unix rights, meaning that if u have allowed the user to run it (using chmod), then he or she can run it, else he or she will be denied access to it.

arutAuthor Commented:
startx is available but the problem is only root is able to connect

hOW DO i authorize a new user added by using the command
"adduser " to connect to X SERVER ?

Kindly help,
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Can an ordinary user (a user other than root)  login at all?  Not to be pedantic, but we need to establish what an ordinary user can or cannot do on your computer -- and precisely what you mean by "connect to X server."

If an ordinary user cannot even login, then you must login as root and use adduser to create an account for them.  If you want to create an account for some one named "Tom" and provide them a pass word of "bug$ziP"  you can do it this way:

#   adduser tom
#   passwd tom

When you type "passwd tom"  Linux will prompt you to type the password a couple of times.  That's when you type "bug$ziP"  (or whatever password you choose.  Note that the command is spelled passwd -- not password.  You won't see the password on the screen as you enter it.

After that,  you can logout as root -- attempt to login as "tom" and use the "startx" command to try running X Windows as an ordinary user.

If that isn't the problem, or if you are beyond that already,  can you explain in more depth the problem you are experiencing?
arutAuthor Commented:
I am able to login as another user .
But from that login prompt if I type startx it won't connect to X server. iT tries and times out and some message like not
authorized is flashed.

Basically I would like to connect to X Server from the new user's
login prompt.


The above should be able to connect TOM with X server so that
he can make use of GUI.

This is currently not happening .

Only root has the privileges currently.

I hope its clear now.

/usr/X11R6/bin/xhost +server that you want to send info to
man xhost says:
       The xhost program is used to add and delete host names or user names to the list allowed to make connections to
       the X server.  In the case of hosts, this provides a rudimentary form of privacy control and security.   It  is
       only sufficient for a workstation (single user) environment, although it does limit the worst abuses.  Environ-
       ments which require more sophisticated measures should implement the user-based mechanism or use the  hooks  in
       the protocol for passing other authentication data to the server.

       Xhost accepts the following command line options described below.  For security, the options that effect access
       control may only be run from the "controlling host".  For workstations, this is the same machine as the server.
       For X terminals, it is the login host.

       -help   Prints a usage message.

       [+]name The  given  name  (the  plus sign is optional) is added to the list allowed to connect to the X server.
               The name can be a host name or a user name.

       -name   The given name is removed from the list of allowed to connect to the server.  The name can  be  a  host
               name  or a user name.  Existing connections are not broken, but new connection attempts will be denied.
               Note that the current machine is  allowed  to  be  removed;  however,  further  connections  (including
               attempts  to  add  it  back) will not be permitted.  Resetting the server (thereby breaking all connec-
               tions) is the only way to allow local connections again.

       +       Access is granted to everyone, even if they aren't on the list (i.e., access control is turned off).

       -       Access is restricted to only those on the list (i.e., access control is turned on).

       nothing If no command line arguments are given, a message indicating whether or not access control is currently
               enabled is printed, followed by the list of those allowed to connect.  This is the only option that may
               be used from machines other than the controlling host.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.