Problems in CygWin accessing /dev/nul as non-privileged user

0

NOTE: This question is originally a simple typographic mistake (nulinstead of null) for the questioner. Anyway, the details could be useful for anyone having the same error and arriving here after a research. Remember: the problem is not exactly in the user privileges.

I have tried to open a CygWin's Bash shell via SSH login with a limited (not belonging to the Administrators group) user's account, and tested:

$ echo "test" > /dev/nul
bash: /dev/nul: Permission denied

This problem does not happen with Administrator account.
I have read through the web that CygWin has difficulties to run with a limited user's account, but I have not found any workaround for this.
Does anyone know if there is an available solution?

EDIT: Thanks to @DanielB, now I know the problem was a simple typo: nul instead of null. So the question should now be:

Why an admin user doesn't have this problem?

Sopalajo de Arrierez

Posted 2014-04-12T22:34:07.913

Reputation: 5 328

Answers

4

The correct device name is /dev/null. This is what's causing your issue.

Update

Well, as for the admin problem – it's simply a permission thing. Although I'm not so sure it's admin-related.

stat /dev reveals the following:

Access: (0755/drwxr-xr-x)  Uid: ( 1001/   fuzzy)   Gid: (  513/    None)

Where fuzzy is my account name. This means my account (and only my account) actually has write permissions in /dev.

Using a non-existent redirection target automatically creates it. The results are as follows:

$ echo bla > /dev/null
$ file /dev/null
/dev/null: character special
$ echo bla > /dev/nul
$ file /dev/nul
/dev/nul: ASCII text

As you can see, this results in a regular file being created in /dev. This file also actually stores what's pushed into it and as such consumes disk space.

Daniel B

Posted 2014-04-12T22:34:07.913

Reputation: 40 502

OMG, I am an idiot. Thanks, @DanielB. This is what could happen when you do too much windows and linux cross-scripting. :-) – Sopalajo de Arrierez – 2014-04-12T22:45:55.457

@SopalajodeArrierez Please see the updated answer. – Daniel B – 2014-04-13T12:15:07.167

It is clear now, @DanielB: the problem was not about user permissions in shell. It is a curious thing how a simple typo can drive you for so wrong roads in your researchs to solve a problem. I have reworded the original question so it could become useful for the forum, instead of a dumb's babble. Thanks again. – Sopalajo de Arrierez – 2014-04-13T14:06:22.280