• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 325
  • Last Modified:

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,
1 Solution
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,
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now