Live data from Hacker News

Why the Unix newgrp command exists (sort of)

utcc.utoronto.ca

21–30 of 35 posts

Re: Why the Unix newgrp command exists (sort of)

#21

Earlier quoted context omitted.

It could also eliminate a race condition.

Good point. I hadn't thought about that. With careful use of umask, chgrp, and chmod (in that order and with proper error handling), you could protect yourself, but just setting it to the right value in the first place seems simpler.

If you're talking about command line programs (as opposed to fchown/fchmod on an open fd), there's still a race whereby an attacker in the shared group can make a link and get you to chgrp away one of your personal files.

Re: Why the Unix newgrp command exists (sort of)

#22
post #12

Earlier quoted context omitted.

Your comment reminded me of the classic Ken Thompson quote: >Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e." There was definitely a mentality at this time that symbols should be short. Probably partly because of the low resolution terminals of the time, and especially teletypes but also maybe because of different practices and a…

usr stands for UNIX system resources

Backronym.

Home directories were originally stored in /usr, as are another user programs

“ In particular, in our own version of the system, there is a directory "/usr" which contains all user's directories, and which is stored on a relatively large, but slow moving head disk, while the othe files are on the fast but small fixed-head disk. “

Re: Why the Unix newgrp command exists (sort of)

#23
post #12

Earlier quoted context omitted.

Your comment reminded me of the classic Ken Thompson quote: >Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e." There was definitely a mentality at this time that symbols should be short. Probably partly because of the low resolution terminals of the time, and especially teletypes but also maybe because of different practices and a…

usr stands for UNIX system resources

"Referer" stands for "referrer".

Re: Why the Unix newgrp command exists (sort of)

#24
post #12

The real question is: why not just suck it up and include that "ou"?

Your comment reminded me of the classic Ken Thompson quote: >Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e." There was definitely a mentality at this time that symbols should be short. Probably partly because of the low resolution terminals of the time, and especially teletypes but also maybe because of different practices and a…

Are we sure he didn't mean "cret" ?

Re: Why the Unix newgrp command exists (sort of)

#25
post #12

The real question is: why not just suck it up and include that "ou"?

Your comment reminded me of the classic Ken Thompson quote: >Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e." There was definitely a mentality at this time that symbols should be short. Probably partly because of the low resolution terminals of the time, and especially teletypes but also maybe because of different practices and a…

I believe its more that the original only had 5 char max ids.

So we get fcntl and ioctl -- two different shortenings of `control` !

Re: Why the Unix newgrp command exists (sort of)

#26
post #12

The real question is: why not just suck it up and include that "ou"?

Your comment reminded me of the classic Ken Thompson quote: >Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e." There was definitely a mentality at this time that symbols should be short. Probably partly because of the low resolution terminals of the time, and especially teletypes but also maybe because of different practices and a…

creat makes me think of creatine, and given the topic, brogrammers.

Re: Why the Unix newgrp command exists (sort of)

#27
post #12

The real question is: why not just suck it up and include that "ou"?

Your comment reminded me of the classic Ken Thompson quote: >Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e." There was definitely a mentality at this time that symbols should be short. Probably partly because of the low resolution terminals of the time, and especially teletypes but also maybe because of different practices and a…

A footnote in Rochkind's Advanced UNIX Programming is that they could add `lseek` in addition to `seek` because they'd saved a character in `creat`

Re: Why the Unix newgrp command exists (sort of)

#28

At a previous job, I had to use newgrp quite frequently. There's a limit on the number of "active" groups you can be in at a time, typically 16. Groups were used for permissions for directories on network storage and our version control system at the time. As far as I'm aware, I was the only person at the company affected because I touched so many different repositories, I was a member of around 20 groups. I had to b…

My hack to get around this was to have the user an groupadmin but not necessarily a member of the group. Then that user could add and remove themselves from a group as required, keeping under the 16 limit.

Re: Why the Unix newgrp command exists (sort of)

#29

The newgrp command also changes your primary group. This affects the gid on new files that get created (a field in the new file's inode). Try these commands: id touch a newgrp cdrom # or any group other than the first one id # note that gid is now 'cdrom', # and it's also first on the groups= list touch b ls -l a b # note different group ownership exit # leave the extra shell that newgrp created This can actually sav…

Depends. On BSD systems, files inherit the directory group.

Re: Why the Unix newgrp command exists (sort of)

#30

The newgrp command also changes your primary group. This affects the gid on new files that get created (a field in the new file's inode). Try these commands: id touch a newgrp cdrom # or any group other than the first one id # note that gid is now 'cdrom', # and it's also first on the groups= list touch b ls -l a b # note different group ownership exit # leave the extra shell that newgrp created This can actually sav…

Depends. On BSD systems, files inherit the directory group.

You can get that behaviour on linux, if you set setgid bit on the directory permissions, e.g. chmod g+s
Post reply on HN