« first day (2682 days earlier)      last day (2570 days later) » 

05:04
@Jesse_b This person wants you for some reason: unix.stackexchange.com/q/423329/73093
 
3 hours later…
08:15
Does anyone have a link to a corporate (or academic or otherwise) policy document describing the use by system administrators of interactive root shell sessions? I'm getting a bit fed up with users asking "my colours doesn't work with sudo su -" or "my root's shell session doesn't behave like my user's shell session", and I would like to be able to (possibly) point to a document saying "don't do that, silly person".
It's my personal opinion that a user should never find themselves in front of an interactive root shell prompt (unless under extraordinary circumstances).
From the point of view of a company/university, that would be really bad for at least a few reasons, security just being one of them, the ability to audit the system (see who did what) being another.
It's pretty common recommendation to open a root shell in advance of major upgrades, on the basis of not wanting to get stuck with a broken sudo/libc/... if something goes wrong
@MichaelHomer There's always single user mode for that though.
I'm not sure it's a better recommendation than having a statically-linked busybox su around for the same circumstances, but it is widespread
I suppose the live shell also accounts for broken passwd/PAM/... as well
Well, there's sometimes single-user mode. If you only have remote access there may not be.
@MichaelHomer True. At my site we have "maintenance days" every month during which the system may be taken off-line without notice (hmm... that was not really related though). What I'm concerned about are users using root "just to get things done" without actually caring that it may be a really bad habit to get into.
... esp. if they go into a sysadmin role later.
cas
cas
09:10
@Kusalananda using a root shell for administrative tasks is not a problem. That's what it's for. Using a root shell for non-administrative tasks is a potential disaster (with the probability and severity inversely and exponentially proportional to the user's skill and caution).
 
3 hours later…
12:25
@cas I'd be careful even about using interactive root shell for admin tasks. It's uncommon for a task to require more than a couple commands (I'm sure it depends), and those should be able to run through something like sudo (or doas on OpenBSD). That ensures that the commands are also logged.
I'd even go as far as saying that setting up aliases for root is a bad thing.
 
1 hour later…
13:30
@MichaelHomer Yea in his last question he didn't mention that the variables were unset and showed the following error: bash: cd/: No such file or directory
So I had just commented that it looked like he executed cd/ instead of cd /. I don't know why that made him think I'm an expert :p
@Jesse_b I wondered about that error message. The root directory is not removed by what he did, and the cd command is a shell built-in. What's actually happening there?
@Kusalananda I'm not sure because on my systems when I try to cd to a non existent directory it shows: bash: cd: dir: No such file or directory
maybe he's trying: "cd /" ?
@Jesse_b So I think you may be right. The shell does not find the command cd/.
$ cd/
bash: cd/: No such file or directory
@Kusalananda: don't judge my # >.>
# "cd /"
-bash: cd /: No such file or directory
# cd fakedir
-bash: cd: fakedir: No such file or directory
I don't have any ubuntu systems but on sunos, centos, and macos there is a colon between cd and the dirname
13:47
@Jesse_b Yes, so the error is simply due to a typo in the command that he wrote.
Well if he did actually delete everything (or mostly everything) perhaps he deleted the cd binary?
I don't get how he would be able to do anything though
@Jesse_b It's a shell built-in command (it needs to be).
Fair enough and he is getting errors from bash so bash must still be there
@Jesse_b Well, it's one of the things already running, but it's actual binary file may have been deleted.
Yea that is a tough situation. Hopefully a valuable lesson learned
13:50
@Kusalananda That seems like an extreme position. Nothing wrong with being root, as long as one is careful.
"Don't do silly things as root" (see rant from earlier today too)
I saw a question on here around the time I first joined where someone did a chmod glob on the root dir by accident and was asking for a way to fix it
@FaheemMitha I'm in a bit of a corporate mindset about how I think about root.
"How would I manage a team of sysadmins?" "What do I do if something fails?" "How may I document procedures?" and things like that.
@Kusalananda I agree with you. I hate being root on any server at work and I only do it when ldap is broken. I only use root on my test server because I only spun up that vm to test some things and honestly didn't expect to still have it at this point
If you have production systems that other people rely on (maybe even medical staff or similar), what sysop procedures must be in place to minimize risk?
Logging in as root and setting up aliases on colours is not something that I'd want a sysadmin to do.
13:54
@Kusalananda If you force people to use sudo, at least what they do is documented.
Yes. And that is one of my points. Sudo is good.
Of course, if people have no idea what they are doing, then it could be a problem waiting to happen.
Unless you have a habit of using sudo -s to gain a shell
But Unix systems aren't that hard to manage. You just have to use a little common sense.
@FaheemMitha Ho hum
13:56
@Kusalananda ?
@FaheemMitha something about extreme positions...? ;)
@Jesse_b Pardon?
You had suggested Kusalananda was taking an extreme position on root earlier. I think the common sense statement is a bit of an extreme position as well
@Jesse_b Possibly. But personally I would like to be able to use root.
You think expecting people to have common sense is an extreme position?
If I have a multi user system (or several) with services running in containers here and there, some of which may have public-facing interfaces, and managing sensitive data (genomic data in my case), I'd be turning down an applicant who says "Unix is easy to administrate".
13:58
@FaheemMitha I think it's hard to define common sense. I think it's even harder to apply that term to a unix system because I would argue none of this is common knowledge.
@Kusalananda I thought we were talking about people's private machines.
Definitely not about servers.
@FaheemMitha You never know where stuff on this site ends up.
@Jesse_b <Shrug.> Maybe so. I think I broke a Linux machine once. And that was in 1999, when I'd had less of a year of experience. And I think there was a complication with an unfortunately timed power outage.
You can choose to do crazy things. Or you can be sensible. It's your choice. But I suppose betting on people to be sensible may not be a good bet in the long term.
I honestly don't think I've broken anything yet but I still fear that I will almost every day :p
@Kusalananda Fair enough.
Bottom line - if I can't use root, I feel disempowered.
Anyway, dinner time. Back in a bit.
14:04
Cheers!
(I was in the UK for too long...)
Something about the title of that question from earlier is disturbing me. "Trivial rm -rf..."
Was it so trivial when it wiped the system?
14:32
@Jesse_b I tried to sort out my thought about that question and wrote an answer.
14:48
@Kusalananda Nice, I feel like this question should be used as some sort of reference material for people entering the unix/linux world :-P
I'm going to be giving classes to new hires at my noc and I'm definitely going to point them to it
@Jesse_b Nice. What's "noc"?
network operations center, although we tried to change it to COC for cloud operations center and now it's unofficially CNOC for cloud and network operations center
Ah. Ok.
CNOC CNOC! Who's there?
hah, do you work for my company? :p
the header of our chat is "NOC, NOC! Who's there?"
is modulo a shell operator or bash?
@Jesse_b :-)
@Jesse_b I will have to look arithmetic contexts up.
@Jesse_b You should be able to use % line this, for example: m=$(( p % 3 ))
It looks as if that should be POSIX,
Or, if (( p % 2 )); then echo not even; fi
15:01
Thanks. Had to fix my answer a bit there
@Jesse_b You don't need ${...} around counter there.
Yea I just don't like the way $var% looks
I suppose I could just use spaces
remainder=$(( counter % 5 ))
Yeah.
thanks
Or, you could just use if (( counter % 5 )); then echo "not multiple of 5"; else ... (test that first).
15:06
yea I was trying different versions of that and getting errors. Didn't try it exactly that way though
didn't work, maybe that isn't an sh thing?
@Jesse_b Ah, yes. I see now. (( ... )) is mentioned in POSIX , but as an "extension".
bash handles it though.
"shells which implement an extension whereby "((expression))" is evaluated as an arithmetic expression may treat the "((" as introducing as an arithmetic evaluation instead of a grouping command."
Well you know I love bash but you also convinced me to try and answer in sh if possible :p
:-) Yes, and the question does in this case not mention a specific shell.
@Jesse_b Steeldriver, he's on our tails! :-)
he also used [ instead of [[ so I assumed sh compatibility is necessary
That question still doesn't make any sense to me, I hope that is what he is looking for although based on his comment I think it is
@Kusalananda: I had original used quotes inside of ((...)) in that answer but I removed them
I removed them before he even posted that comment though :/
15:24
No worries. The question itself could be clearer.
I mean it's definitely unclear but he was asked:
"So do you want to check if $COUNTER is a multiple of 5?"

and responded with:

"yes like 5 , 10 , 15 or 200 , 400 , 600 something like that ."
@Jesse_b You could give an expanded solution using a loop from 1. If the value is a multiple of the value from the command line. print a string. I think this is what's asked for.
@Kusalananda working on it
what is the word for truncating from the center lol
I wonder why (( ... )) works in the sh for loop but not an if conditional
I'm not very good at math but I really enjoy using it in scripts
15:48
@Jesse_b The for (( ... )) thing is bash though.
It's a bit of a jungle, isn't it?
Hmm, it works with the /bin/sh hashbang but if I try if (( i % 5 )); then it errors
Would this be sh then:
#!/bin/sh
i=0
while [ "$i" -le 600 ]; do
        remainder=$(( i % 5 ))
        [ "$remainder" -eq 0 ] && echo "$i is a multiple of 5"
        ((i++))
done
Not the ((i++)) bit, but i=$(( i + 1 )) would be.
To be honest, I'm a little bit hazy on all this arithmetic stuff.
Thanks. I'm doing this on my mac and IIRC mac has it's own bespoke sh
You could even use while [ "$(( ++i ))" ... if that suits the application.
I'm not entirely sure I recall what shell sh is on macOS. It may be ksh93. Or bash.
it's not a symlink to anything
15:54
@Jesse_b May well be a hard link.
old bash then :-P
Yes. 3.x something.
{0} ➔ /bin/sh --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
Copyright (C) 2007 Free Software Foundation, Inc.
I'm taking a break to do something completely different for a while. My hands are tired. Be well!
You too! I should step away as well and shovel my driveway before I get fined for not doing it
 
1 hour later…
17:12
reasons to understand how the shell works and interprets its command line, part N
@ilkkachu LOL! Literally!
 
1 hour later…
18:14
@terdon I flagged this for mods, but I'll ping you here too. See mod flagging message. I think it should remain closed, but it may be for the wrong reason. Also, we were possibly a bit too quick with closing it... unix.stackexchange.com/questions/423405/…
-1
Q: What is set-mark in bash and how should I expect it to behave?

argleIt's just mentioned a shortcut for and its usage is supposed to be obvious, but it isn't obvious to me. How do I even tell I "marked" something? Why would I mark something? Does this thing have a scope? Does it ever expire? And do I get a bash warning when/where it did? And above all, cool, I "se...

@Kusalananda thanks. I edited to leave just the main question.
@terdon Thanks.
I will not interfere with that question.
18:38
By the way, @Kusalananda, asking for official documentation is explicitly on topic. So even if the question were "where is this documented", that would have been fine.
Note the wording of the close reason (emphasis mine):
> Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information.
@terdon Aha! That parenthesis has had me believe that "official documentation" only refers to the POSIX documentation. I see now that this is not the way to interpret it.
Silly me.
while ((engineer)); do
  interpret=literal
done
@Jesse_b And throw out unimportant bits like "e.g."... :-/
@Kusalananda The close reason is quite obviously not very clear seeing how many users misunderstand it. I really need to open a new meta for this when I get the chance. But yeah, the POSIX is just an example, hence the "e.g." :)
@Kusalananda :-P Yea but shh I was defending you >.>
18:45
I'm just happy I haven't closed more questions because of this.
(as far as I can remember)
The rule of thumb is: is the question something that can be answered here? The it's fine. Is it instead asking for video tutorials or some such? Then close. You can see the meta discussion linked in the close reason to understand the history of it and the rationale.
15
Q: How do we feel about requests for learning materials?

terdonWe recently had a brief discussion in chat about this question which asks for learning materials (specifically, online video courses). I feel that such questions are not a good fit for the site because: They are not about a problem. The SE network specializes in giving specific solutions to spe...

lots of really long questions lately
19:29
I'm going to call our two cats "Farty" and "Poopy" from now on...
19:40
Hello again, folks.
20:21
Happy birthday (recently?), @Kusalananda! ref
@Kusalananda I interpreted that line the same way! Thank you for the discussion!
@JeffSchaller Not really, but closer to 45 than to 44 (the birthdays, that is). It's not until May :-)
I feel like 50 though...
@JeffSchaller Phew, I'm not alone!
@JeffSchaller I was updating it a tiny bit anyway, so I thought I'd increment the age or I'll forget it. And it's such an important piece of info too... :-)
I just removed the text 0 down vote favorite from a handful of questions. I wonder where that came from. Copy & paste from the web?
20:52
@Kusalananda really strong hint of a cross/multi-post, yes. Gives me a good idea for a SEDE query!
@Kusalananda Suggest instead maybe: "I am $(( year - 1972 )) years old" ? (where 1972 is the correct year, of course)
@JeffSchaller hurray! only one hit, and it's the post you just edited
21:11
@JeffSchaller Good suggestion!
21:42
@Kusalananda Quite often that turns out to be someone copying a legitimate question to use as a spam seed. I don't know why they're so bad at it.
cas
cas
22:36
@Kusalananda mine are regularly called things like "puke-beast" (with optional "wretched" modified, depending on what, exactly, they puked on). I suppose having a hair-trigger vomit reflex is a useful survival adaptation for a hunter-scavenger. Fortunately they almost never crap or piss anywhere they're not supposed to.

« first day (2682 days earlier)      last day (2570 days later) »