Constant sudo password prompts

Octopuss

Patron
Joined
Jan 4, 2019
Messages
461
I am sick of having to enter sudo password every few minutes (I presume there's a limited time frame while the password sticks). Is there a way to disable this?
 

Octopuss

Patron
Joined
Jan 4, 2019
Messages
461
Oh, that sounds like a partial solution at least.
But is it possible to disable the timeout alltogether?
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
You can set it to -1 which disables the timeout completely. I'd say use good judgement on your risk tolerance tough, there's a reason that timeouts are a thing.
 

Octopuss

Patron
Joined
Jan 4, 2019
Messages
461
Well this is a home server so I don't think I need passwords for anything.
 

Octopuss

Patron
Joined
Jan 4, 2019
Messages
461
Hmm, it doesn't even work.
1642533405930.png


There is no cursor or anything, I can't type..

Sorry I am an idiot who knows absolutely nothing about Linux.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776

Octopuss

Patron
Joined
Jan 4, 2019
Messages
461
The controls make no sense omg.
There is cursor, but the controls are pure retarded. When I type a character, whatever the cursor is on is overwritten.
When I put the cursor on the very beginning and type, the cursor moves one line down.
My head hurts, there is literally NO functionality that resembles ANY controls of ANY editor I've seen since MS DOS 6.
I give up. WTF. I can't wrap my head around this nonsense.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
This is a modal editor named "vi". I posted a link to an introduction. You need to learn how to use it to edit files on any Unix system. Or use a different editor. I don't know which ones are available on TrueNAS SCALE.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
P.S. ESCAPE, followed by : q ! and ENTER will get you out of it.
 

Octopuss

Patron
Joined
Jan 4, 2019
Messages
461
Thanks for the help, but this is beyond what I can comprehend. I am used to sane controls. This is just crazy. I'll stick to typing in the damn password.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I am used to sane controls.

Like....? Seriously, vi has some of the sanest controls. People actually edited stuff at one time with nothing but standard home row typing skills. No need for "arrow keys" or "mice". :smile: Many people still prefer this type of very precise, extremely quick, and incredibly powerful editing to the chumpy style Microsoft/etc WYSIWYG graphical editors that don't do much more than let you edit text keystroke by keystroke. Sane is relative. :smile:

If you are on TrueNAS Core or FreeNAS, FreeBSD includes the "ee" editor, which might be more to your liking. Try typing

EDITOR=ee visudo

at the root command prompt. TrueNAS Scale (and also the others) include the "nano" editor as well. Try

EDITOR=nano visudo

at the root prompt.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680

Incidentally, this immediately goes into a VIM-ism for cut and paste that won't work on FreeBSD (the v-cursor-highlight thing). It's like people passing off bad bash'isms as sh code.

Looking around, I suspect that the following is better:



My head hurts, there is literally NO functionality that resembles ANY controls of ANY editor I've seen since MS DOS 6.

Actually, that's probably not true. The actual problem with vi isn't that it has NO functionality. It has TOO MUCH functionality, and the variants such as VIM are even worse. The cheat sheet above has 66 movement and direct editing commands. Speaking as someone who is in vi for at least an hour a day for about four decades, I can say that I only ever use 25 of those 66 commands; the others are unfamiliar to me. But vi's REAL win is its ability to seamlessly manipulate files (using :r to read, :w to write, including writing line ranges), execute ex editor commands (other colon-commands like :10,$s/$/"/ which places a double quote at the end of every line in the file starting at line 10), and other fun and arcane regex editing that would be a killer if you had to do it all by hand.

I actually learned ex first, which put me at a huge advantage because you had to actually think about what you were doing. Some seemingly arcane bits of vi become obvious side effects of its history as ex. Being forced to describe a change that you wanted to make to a line in a form the machine can understand is an obvious precursor to describing COMPLICATED changes you want to make to a line or lines, and therein lies the true power of vi/ex, at least in my opinion.

:10,$-5s/^\([0-9]*\)\ foo\ \([0-9]*\)$/\2 bar \1/

Changes every instance of lines between line #10 and the fifth to last line, where the line contains exactly a nonnegative integer number, the string " foo ", and another nonnegative integer, and creates a replacement line that places the second integer in front, "bar", and then the first integer. I am certain I roll off a more complex variant of that several times a week.

It is incredibly functional. It is, however, jarring to people used to simple editors.
 
Joined
Oct 22, 2019
Messages
3,641
It won't persist today across upgrades, but you can use visudo to change it right now.
But it will persist across reboots?

I assumed that nothing survives reboots that isn't part of the freenas-v1.db and other config files found under /data. (Everything else OS-related is reset otherwise?)
 
Joined
Oct 22, 2019
Messages
3,641
Well this is a home server so I don't think I need passwords for anything.
I prefer to keep the default timeout for other reasons besides security and password protection.

I have the habit of hitting "Up Arrow + Enter" on my keyboard (to quickly issue a command I use often). But if I've been away from the computer for a while, I might forget that there was a destructive command more recently executed than what I (mistakenly) remember as the previous command. :oops:

From haste and muscle memory, a quick "Up + Enter" greets me to a password prompt of a root-elevated destructive command, which thankfully stops me from continuing.

Something to consider.
 

Octopuss

Patron
Joined
Jan 4, 2019
Messages
461
Many people still prefer this type of very precise, extremely quick, and incredibly powerful editing
Like what? I mean, what else besides editing text and saving the file is an editor supposed to do? I am genuinely curious what the heck is the appeal of something where you have to press five random keys with little to no visual indication just to LEAVE the damn thing :grin:

And by sane I mean anything Windows, of course :D I've been using it since Windows 95 came out. Heck even old Norton Commander's editor was lighting ages ahead of this vi klingon translator :tongue:

edit: I've just noticed this part of your post.
:10,$-5s/^\([0-9]*\)\ foo\ \([0-9]*\)$/\2 bar \1/

Changes every instance of lines between line #10 and the fifth to last line, where the line contains exactly a nonnegative integer number, the string " foo ", and another nonnegative integer, and creates a replacement line that places the second integer in front, "bar", and then the first integer. I am certain I roll off a more complex variant of that several times a week.
Don't do this to me when I've just woken up!
1642577629816.jpeg


But obviously, I am not the target audience for anything Linux; it's only when I built this server I had to start dealing with this craziness I will most likely never comprehend. I wouldn't mind to learn Linux (and just the fact there are about 500 Linuxes and then there are Unixes and I don't understand what the heck the difference is is killing my brain cells as it is, lol)
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
I have the habit of hitting "Up Arrow + Enter" on my keyboard (to quickly issue a command I use often). But if I've been away from the computer for a while, I might forget that there was a destructive command more recently executed than what I (mistakenly) remember as the previous command. :oops:

From haste and muscle memory, a quick "Up + Enter" greets me to a password prompt of a root-elevated destructive command, which thankfully stops me from continuing.

Something to consider.
One other trick you can do with most shells is type history, and then type !<item number> to repeat it.
Code:
MacBook-Pro:ports awalker$ history | grep "git status" -m 1
  140  git status
MacBook-Pro:ports awalker$ !140
git status
On branch NAS-114370


This can help break muscle memory for arrow + enter.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
One other trick you can do with most shells is type history, and then type !<item number> to repeat it.

This only works on shells where this doesn't cause a subprocess for the shell builtin to be spawned (i.e. with no history). That's why oldtimers usually don't do this. :smile:
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Like what? I mean, what else besides editing text and saving the file is an editor supposed to do?

Well, I'm totally with you on that. It's usually the VIM guys who get really fancy, or I remember the Emacs guys who implemented Tower of Hanoi back in the 1980's... but I can see the attractiveness of features that extend an editor. We do actually support vim in the syseng environment here, because it contains integrations with Syntastic, a syntax-checking and code formatting tool. For example, if I edit one of our build scripts, it kicks out a complaint:

Code:
    1 #! /bin/sh -
    2 #
    3 # Copyright (c) 2001,2004,2005,2015,2017,2021 by Joe Greco and
    4 #       sol.net Network Services.
    5 # Unauthorized use or reproduction is strictly prohibited.
    6 #
    7
    8 # $Id$
    9
   10 openssl=1.1.1l
   11 libidn2=2.3.2
[Syntax: line:248 (2)]
  1 src/makeitall|248 col 1 warning| pkgconfdir appears unused. Verify use (or export if used externally). [SC2034]
  2 src/makeitall|249 col 1 warning| pkgconfdir2 appears unused. Verify use (or export if used externally). [SC2034]
~


It has correctly identified that pkgconfdir and pkgconfdir2 are unused variables. We don't care in this case because the format for these scripts is a standardized format, but this particular module has no libraries to worry about, and never utilizes these two variables.

I am genuinely curious what the heck is the appeal of something where you have to press five random keys with little to no visual indication just to LEAVE the damn thing

Explain to me why you should have to lift your fingers off home row, move your hand to a mouse, move a cursor up to "File", go down to "Save", and then "File", and "Quit". Quite frankly, I can hit esc-colon-:wq!-enter very quickly, a lot more quickly than that crappy mouse sequence. And you're assuming that the user knows how to use a windowed operating system. That's not a foregone conclusion. I remember in the '80's that my mom learned WordPerfect, a similar keystroke-oriented word processor, and then had to learn Windows, and boy was that crappy. But your complaint about "five random keys" would apply equally to many '80's word processors; since people paid a lot of money for them, I have to assume your premise is flawed.

The "appeal" of it is that it it worked on a UNIX system with half a million instructions per second, 512KB of RAM (that's KB not MB), and was brilliant in that it supported both teletype terminals (keyboard with a paper printer) in its "ex" mode, and also the newfangled video terminals with cursor movement ("vi" mode). There literally WAS no graphical option, we were HAPPY when CRT's and vi came around.

target audience for anything Linux

Well, this isn't Linux. Linux doesn't actually have a genuine vi that I'm aware of, relying instead on vim, whereas FreeBSD's nvi is at least a historically credible vi derivation. vim is a big fat ugly pig with a bunch of warts, but is similar to vi.

I don't understand what the heck the difference is is killing my brain cells as it is

Linux is a clone UNIX-wannabe OS written by Linus Torvalds and other contributors under the GPL, which makes it a non-free OS because it has significant limitations on distribution, modification, and use.

SysV, SunOS, BSD, etc., all derive from a common true UNIX heritage.

800px-Unix_history-simple.png

Don't do this to me when I've just woken up!

That thing I gave you, it's just a search and replace. It's just an adult-grade search and replace, not like the simplistic kiddie-grade stuff you can do with your Windows WYSIWYG editor. :smile:
 

rvassar

Guru
Joined
May 2, 2018
Messages
972
The controls make no sense omg.
There is cursor, but the controls are pure retarded. When I type a character, whatever the cursor is on is overwritten.
When I put the cursor on the very beginning and type, the cursor moves one line down.
My head hurts, there is literally NO functionality that resembles ANY controls of ANY editor I've seen since MS DOS 6.
I give up. WTF. I can't wrap my head around this nonsense.

You have stumbled upon what amounts to a religious argument, and it's been going for probably 45+ years. Understand Unix was written by computing's second generation of pioneers. They had machines, clunky terminals that had just recently switched from fan-fold paper to cathode-ray tube displays. They created a powerful timesharing operating system, but at the same time they were probably the original carpal tunnel injury victims. There was very little ergonomics in the 70's and early 80's, most Unix commands seek to minimize hand motion and keys pressed. Vi was written by a college student at UC Berkeley in 1976 to implement a "visual interactive" editor on top of /bin/ex in what was then a fledgling Unix command tradition. His name was Bill Joy. He was part of the core BSD team at Berkeley, and went on to become a founder of a (now defunct) company called Sun Microsystems.

More info:
Vi at Wikipedia
Editor war at Wikipedia

So you can rail all you want about /bin/vi. But you'll only elicit a chuckle from the graybeards here... Followed by "You could always try Emacs!" :wink:
 
Top