remove banner and sudo question for standard user

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
ben0a
Posts: 5
Joined: Sun May 20, 2018 6:40 pm

remove banner and sudo question for standard user

Post by ben0a »

Dear all,

Hope you are doing well.
New install on an odroid c2, I have created a user and made it part of the sudoers group. Everything goes fine except one thing.

When I'm sshing to the box I'm asked to sudo and my password before getting the bash prompt.
I think this come from the dietpi launcher and I'm looking for a way to remove this two step behaviour which breaks all my remote scripts to connect and do stuff on this machine.

What is the best and recommended way to remove this feature :? please?

Thanks
User avatar
MichaIng
Site Admin
Posts: 2262
Joined: Sat Nov 18, 2017 6:21 pm

Re: remove banner and sudo question for standard user

Post by MichaIng »

@ben0a
We run some parts of our login script via sudo. Indeed this leads to an additional password prompt, if configured for sudo + related user. We're anyway change the way how/where our login script is called for v6.9, so I think we can address as well the issue, if a user with password protected sudo right is used.
Would be interesting, if the command is just skipped of -n option is used:
-n, --non-interactive non-interactive mode, no prompts are used
Do you need sudo password protected?
Otherwise remove password protection from it by adding the sudoers line: username ALL=NOPASSWD: ALL
If you need it, I will give you some more info in how to manually fix this.
jdorigatti
Posts: 1
Joined: Sun May 20, 2018 10:10 pm

Re: remove banner and sudo question for standard user

Post by jdorigatti »

I too would be very interested in how to disable this functionality.

I would like to create a non-sudo privileged user account that could be accessed from a remote source for security purposes. Is there a way to disable this for certain users?
Nudelnup2
Posts: 1
Joined: Sun May 20, 2018 10:05 pm

Re: remove banner and sudo question for standard user

Post by Nudelnup2 »

Hello all,
first of all thank you for the great work!
I ran into this issue and forgot to check the forum in the first place :cry: , so I narrowed the sudo call down to the call of the "obtain_network_details" script inside the "login" script. For my purpose it was ok to deactivate the specific call of the complete script. :x.
Is it correct that the call to the "obtain_network_details" in the "login" script is in this case is "just" used to get IP information for the banner?

You probably already know, but the issue also occurs for any new user created, even if they are not added to the sudo group.

Best regards!
ben0a
Posts: 5
Joined: Sun May 20, 2018 6:40 pm

Re: remove banner and sudo question for standard user

Post by ben0a »

@MichaIng

Thanks a lot for the prompt answer. this is fantastic if in a future realease this behavior can change as it lacks remote scripting capabilities. (but this is also very nice)

I can not do sudo without password as you suggest, this server and network is two much at risk using this way.
Can you give me some instruction on how to disable this part please as you suggested?

thanks
ben0a
Posts: 5
Joined: Sun May 20, 2018 6:40 pm

Re: remove banner and sudo question for standard user

Post by ben0a »

Exactly what i'm looking for, do you recall where you removed it please?

Nudelnup2 wrote: Sun May 20, 2018 10:16 pm Hello all,
first of all thank you for the great work!
I ran into this issue and forgot to check the forum in the first place :cry: , so I narrowed the sudo call down to the call of the "obtain_network_details" script inside the "login" script. For my purpose it was ok to deactivate the specific call of the complete script. :x.
Is it correct that the call to the "obtain_network_details" in the "login" script is in this case is "just" used to get IP information for the banner?

You probably already know, but the issue also occurs for any new user created, even if they are not added to the sudo group.

Best regards!
ben0a
Posts: 5
Joined: Sun May 20, 2018 6:40 pm

Re: remove banner and sudo question for standard user

Post by ben0a »

Just replying to myself:

Code: Select all

sudo nano /etc/profile.d/99-dietpi-login.sh
You will get this:

Code: Select all

. /DietPi/dietpi/func/dietpi-globals
 /DietPi/dietpi/login
replace it by:

Code: Select all

. /DietPi/dietpi/func/dietpi-globals
# /DietPi/dietpi/login
Just save and this is over :D
I feel a little dirty by doing this but it works.
Thanks all of you for the prompt answers which helped me finding it.
ben0a wrote: Mon May 21, 2018 6:49 pm Exactly what i'm looking for, do you recall where you removed it please?

Nudelnup2 wrote: Sun May 20, 2018 10:16 pm Hello all,
first of all thank you for the great work!
I ran into this issue and forgot to check the forum in the first place :cry: , so I narrowed the sudo call down to the call of the "obtain_network_details" script inside the "login" script. For my purpose it was ok to deactivate the specific call of the complete script. :x.
Is it correct that the call to the "obtain_network_details" in the "login" script is in this case is "just" used to get IP information for the banner?

You probably already know, but the issue also occurs for any new user created, even if they are not added to the sudo group.

Best regards!
User avatar
MichaIng
Site Admin
Posts: 2262
Joined: Sat Nov 18, 2017 6:21 pm

Re: remove banner and sudo question for standard user

Post by MichaIng »

Blocking login script completely solves the issue, but disables also DietPi-Autostart options and of course the banner.

I added PR to remove root/sudo requirement: https://github.com/Fourdee/DietPi/pull/1790/files

As root user do the following to enable now:

Code: Select all

wget https://raw.githubusercontent.com/Fourdee/DietPi/diepi-login-non-root/dietpi/func/obtain_network_details -O /DietPi/dietpi/func/obtain_network_details
wget https://raw.githubusercontent.com/Fourdee/DietPi/diepi-login-non-root/dietpi/login -O /DietPi/dietpi/login
/DietPi/dietpi/login
Afterwards you should be able to login with non-root user and of course passwd sudo user without any prompt.
ben0a
Posts: 5
Joined: Sun May 20, 2018 6:40 pm

Re: remove banner and sudo question for standard user

Post by ben0a »

Thanks a lot for this! This is exactly how it should work and far better than my tricks. :D

MichaIng wrote: Tue May 22, 2018 12:06 am Blocking login script completely solves the issue, but disables also DietPi-Autostart options and of course the banner.

I added PR to remove root/sudo requirement: https://github.com/Fourdee/DietPi/pull/1790/files

As root user do the following to enable now:

Code: Select all

wget https://raw.githubusercontent.com/Fourdee/DietPi/diepi-login-non-root/dietpi/func/obtain_network_details -O /DietPi/dietpi/func/obtain_network_details
wget https://raw.githubusercontent.com/Fourdee/DietPi/diepi-login-non-root/dietpi/login -O /DietPi/dietpi/login
/DietPi/dietpi/login
Afterwards you should be able to login with non-root user and of course passwd sudo user without any prompt.
Post Reply