# No permission to connect to localhost?



## frustphil (Aug 26, 2009)

Hi, this is my experience using FreeBSD so please be newbie friendly with your replies.

Anyway, I am setting a mail server. Just finished installing postfix and when I tested connecting to localhost using this command:



> /usr/local/etc/postfix # telnet localhost smtp



I got a prompt saying "Permission denied"

Anyone know how to fix it? I really have no idea about this. Like I said this is my first time using FreeBSD and setting up a mail server. If you could show me how to fix it step by step, I would really appreciate it... Thanks!


----------



## SirDice (Aug 26, 2009)

Permission denied? That doesn't sound like a FreeBSD error message. 
Most likely it's generated by postfix or whatever is listening on port 25.


----------



## Alt (Aug 26, 2009)

This is firewalled port, look your ipfw


----------



## Aprogas (Aug 26, 2009)

Insufficient permissions on /usr/bin/telnet might throw permission denied. Your local firewall not accepting the connection might also give this error. Try telnet on different ports and also try with netcat. Also try to specify 127.0.0.1 instead of localhost.


----------



## DutchDaemon (Aug 26, 2009)

Anything in [cmd=]sockstat -l4p 25[/cmd]? Do you have any form of firewalling enabled?


----------



## SirDice (Aug 26, 2009)

If the port is firewalled one would get either a time out, a connection refused or "no route to host". Not a "permission denied".


----------



## ale (Aug 26, 2009)

What is the output of `$ id` ?


----------



## frustphil (Aug 26, 2009)

Aprogas said:
			
		

> Insufficient permissions on /usr/bin/telnet might throw permission denied. Your local firewall not accepting the connection might also give this error. Try telnet on different ports and also try with netcat. Also try to specify 127.0.0.1 instead of localhost.




/usr/bin/telnet has -r-xr-xr-x permissions. Do I have to change it?
I don't have firewall enabled. Also, changing localhost and ports didn't work.


----------



## Alt (Aug 26, 2009)

SirDice said:
			
		

> If the port is firewalled one would get either a time out, a connection refused or "no route to host". Not a "permission denied".



If connection is forbidden by server from which you connect, you will get permission error. Otherwise refused/timeout.

```
# ipfw add 50 deny ip from any to any 1000
00050 deny ip from any to any dst-port 1000
# telnet localhost 1000
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Permission denied
telnet: Unable to connect to remote host
```

frustphil: If same message, you have firewall enabled =)


----------



## frustphil (Aug 26, 2009)

ale said:
			
		

> What is the output of `$ id` ?



uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)

I'd like to correct my first post... the prompt said 


> /usr/local/etc/postfix: Permission denied


I am sorry I assumed one could pin point the problem directly.


----------



## frustphil (Aug 26, 2009)

So it could be the postfix that's causing the problem?


----------



## Alt (Aug 26, 2009)

Wah! ))
You trying to start it?

Then you must put to your /etc/rc.conf file this

```
sendmail_enable="NO"                                                       
sendmail_outbound_enable="NO"                                              
sendmail_submit_enable="NO"                                                
sendmail_msp_queue_enable="NO"                                             
postfix_enable="YES"
```
And then start with this
[cmd=]/usr/local/etc/rc.d/postfix start[/cmd]

UPD: It may be needed to shutdown sendmail before this


----------



## DutchDaemon (Aug 26, 2009)

You're trying to execute a *directory*, which (under sh, and probably other shells) produces an error message.

E.g.


```
[cmd=$]/etc/mail # bla[/cmd]
/etc/mail: Permission denied
```

Bash would print something slightly more meaningful:


```
[cmd=$]/etc/mail # bla[/cmd]
bash: /etc/mail: is a directory
```

Maybe you copied something from a manual? I'm pretty sure this

[cmd=]/usr/local/etc/postfix # telnet localhost smtp[/cmd]

should be interpreted like this:


```
[/usr/local/etc/postfix]# [cmd=]telnet localhost smtp[/cmd]
```

The first part is simply the directory you're in, the '#' is the prompt, and the 'telnet' part the command.

So try:

[cmd=]telnet localhost smtp[/cmd]


----------



## frustphil (Aug 26, 2009)

I think it's working now but i'm confused. Typing telnet localhost smtp gave me this output:



> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 http://www.mydomain.com ESMTP Postfix



While /usr/local/etc/postfix # telnet localhost smtp gave the permission denied error.


----------



## Alt (Aug 26, 2009)

omg hahaha


----------



## frustphil (Aug 26, 2009)

DutchDaemon said:
			
		

> You're trying to execute a *directory*, which (under sh, and probably other shells) produces an error message.
> 
> E.g.
> 
> ...



my bad.. i didn't know that. so this is all because of my ignorance...x( 
Thank you!:stud


----------



## frustphil (Aug 26, 2009)

Alt said:
			
		

> omg hahaha



lol, I am melting with shame. =)
I am so disoriented with all of this. =)
Thank You!


----------



## Alt (Aug 26, 2009)

Our DutchDaemon is Sherlock Holmes =)


----------



## DutchDaemon (Aug 26, 2009)

I'm sure there's a pipe joke in there somewhere.


----------

