Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've setup TCP forwarding over SSH using the following command:

ssh -N -L 1234: root@

This works no problem. So I decided to create a non-root account user1 on to do this in a more secure/safer way. However, I get a permission denied error message when I try to the same command with the user1 account.

share|improve this question
Are you confident that the error relates to the port forward operation, have you ensured the user can use ssh? – Tim Jul 25 '12 at 17:53
Is there any "Match User ...." directives in your sshd_config? – Tim Jul 25 '12 at 17:54
Aha! Thanks Tim - there was an entry in the sshd_config which was screwing things up. – James Jul 25 '12 at 18:03
Can you post the solution below? – Michael Mrozek Jul 25 '12 at 18:13
@JimR No problem, glad it worked! – Tim Jul 25 '12 at 18:29
up vote 5 down vote accepted

Some distro's come with a premade sshd_config that has separate permissions based on a username or group, example:

Match User anoncvs
       X11Forwarding no
       AllowTcpForwarding no
       ForceCommand cvs server

Jim most likely resolved this by commenting out, or adjusting the directive to match the permissions he needed.

More info available via man sshd

share|improve this answer
That's useful to know - I'm not too familiar with the 'Match' syntax, but I guess it speaks for itself. – James Jul 25 '12 at 18:54
I just commented this out as you said. – James Jul 25 '12 at 18:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.