# [SOLVED] Xorg is listening on tcp port 6000 it SHOULDN'T be

## Sadako

Running `netstat -nlp` I find the X is listening on tcp port 6000, even though this is not what I want;

```
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      1217/X
```

I have the usual 'defaultserverargs="-nolisten tcp -br"' in /usr/bin/startx, I start X with 'startx -- -dpi 96 > /tmp/Xlog 2>&1 & logout', and I don't have ssh configured to allow X11 fowarding (either in the client or daemon configs).

Here's the relevant 'ps -Af' output,  to show what command line args are actually being used;

```
hopeless  1197     1  0 May22 ?        00:00:00 /bin/sh /usr/bin/startx -- -dpi 96

hopeless  1216  1197  0 May22 ?        00:00:00 xinit /etc/X11/xinit/xinitrc -- -dpi 96 -auth /home/hopeless/.serverauth.1197 -deferglyphs 16

root      1217  1216  7 May22 tty5     02:11:33 X :0 -dpi 96 -auth /home/hopeless/.serverauth.1197 -deferglyphs 16
```

Any idea of what could be behind this?

I'm a wee bit paranoid about this, so I've added rules to log and drop any connection attempts to tcp port 6000 in iptables.

Thanks.

----------

## ziggysquatch

I use slim to log in and in the /etc/slim.conf I set the following:

```

xserver_arguments  -nolisten tcp -br -dpi 100

```

I believe the other login managers have similar options or if you use startx then this alias should do it:

```

alias startx='startx -- -nolisten tcp'

```

I know you have the -nolisten set for startx but the above changes are what stopped it from listening for me.

----------

## aronparsons

Edit /usr/bin/startx and on the defaultserverargs="" line, add "-nolisten tcp".  The other suggestion to alias it works as well, but I've always modified 'startx'.

----------

## Sadako

 *aronparsons wrote:*   

> Edit /usr/bin/startx and on the defaultserverargs="" line, add "-nolisten tcp".  The other suggestion to alias it works as well, but I've always modified 'startx'.

 But that's just the thing, it's already set in startx...

 *ziggysquatch wrote:*   

> I use slim to log in and in the /etc/slim.conf I set the following:
> 
> ```
> 
> xserver_arguments  -nolisten tcp -br -dpi 100
> ...

 Thanks, I already use startx via an alias anyway (alias x='startx -- -dpi 96 > /tmp/Xlog 2>&1 & logout'), so I'll just add that to it, I'll report back the next time I start X.

I think I need to take a look at the startx script, though, and figure out why "-nolisten tcp" isn't been used...

If it was set properly by startx, wouldn't it show up in the command line opts for xinit (via `ps -Af | grep xinit`)?

----------

## Hu

 *Hopeless wrote:*   

> I think I need to take a look at the startx script, though, and figure out why "-nolisten tcp" isn't been used...
> 
> If it was set properly by startx, wouldn't it show up in the command line opts for xinit (via `ps -Af | grep xinit`)?

 

The value of serverargs is set from your command line arguments.  If it is still blank after processing the command line, then it is set to the value of $defaultserverargs.  Since you are passing actual arguments, it does not receive the value of $defaultserverargs.

Yes, it would show up in the command line options.

----------

## Sadako

 *Hu wrote:*   

>  *Hopeless wrote:*   I think I need to take a look at the startx script, though, and figure out why "-nolisten tcp" isn't been used...
> 
> If it was set properly by startx, wouldn't it show up in the command line opts for xinit (via `ps -Af | grep xinit`)? 
> 
> The value of serverargs is set from your command line arguments.  If it is still blank after processing the command line, then it is set to the value of $defaultserverargs.  Since you are passing actual arguments, it does not receive the value of $defaultserverargs.
> ...

 Ah...

Thank for that, now it makes sense.

I've only been using -dpi 96 in the alias for a few weeks, so adding it  (-nolisten tcp) to the alias really is the best solution.

Marking as [SOLVED], thanks everyone.

----------

