Announcement

Collapse
No announcement yet.

[SOLVED] Can't get login script to not prompt for password

Collapse
This topic has been answered.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Can't get login script to not prompt for password

    Can't get login script to not prompt for password.

    The script is run on startup and the effects can be seen before first login, yet after I login I am prompted for a password.


    I have a script:
    -rwxrwxr-x 1 nick nick 43 Jun 17 20:57 /home/nick/Documents/Scripts/run_on_login.sh

    Code:
    #!/bin/bash
    systemctl enable --now ratbagd
    I want it to run on login to enable mouse customization. So I add it to autostart and it creates the file:
    -rw------- 1 nick nick 162 Jun 17 20:41 home/nick/.config/autostart/run_on_login.sh.desktop

    I then created the file:
    -rw-r----- 1 root root 239 Jun 17 20:54 /etc/sudoers.d/my_custom_rules

    and have tried all these entries at once

    Code:
    root ALL=(ALL) NOPASSWD: /home/nick/Documents/Scripts/run_on_login.sh
    root ALL=(ALL) NOPASSWD: /home/nick/.config/autostart/run_on_login.sh.desktop
    nick ALL=(ALL) NOPASSWD: /home/nick/Documents/Scripts/run_on_login.sh
    nick ALL=(ALL) NOPASSWD: /home/nick/.config/autostart/run_on_login.sh.desktop
    yet I am still prompted for a password after login.

    What am I doing wrong?

    How do I run a script without being prompted for password?
    Do I have to change the script owner to root, I was hoping to avoid that.​
    Last edited by knuuser; Today, 05:52 AM.
  • Answer selected by knuuser at Today, 05:46 AM.

    modify the script to #!/bin/bash
    sudo systemctl enable --now ratbagd

    Then add a sudoers rule for systemctl:​
    nick ALL=(root) NOPASSWD: /usr/bin/systemctl enable --now ratbagd
    test this manually first with sudo systemctl enable --now ratbagd , it shouldnt ask for password now

    Comment


      #2
      modify the script to #!/bin/bash
      sudo systemctl enable --now ratbagd

      Then add a sudoers rule for systemctl:​
      nick ALL=(root) NOPASSWD: /usr/bin/systemctl enable --now ratbagd
      test this manually first with sudo systemctl enable --now ratbagd , it shouldnt ask for password now
      ʟɨռʊӼ ʄօʀ ʟɨʄɛ

      Comment


        #3
        Originally posted by die.boer View Post
        modify the script to #!/bin/bash
        sudo systemctl enable --now ratbagd

        Then add a sudoers rule for systemctl:​
        nick ALL=(root) NOPASSWD: /usr/bin/systemctl enable --now ratbagd
        test this manually first with sudo systemctl enable --now ratbagd , it shouldnt ask for password now


        Brilliant. Thank you

        I also note that now that the script is fixed I can run nick ALL=(root) NOPASSWD: /home/nick/Documents/Scripts/run_on_login.sh and that works too.
        I can understand the differences in security.
        Last edited by knuuser; Today, 06:02 AM.

        Comment


          #4
          Or just enable the system service to load automatically during boot, unless this is not working for some reason?


          Oops, I miss-read something important.

          Originally posted by knuuser View Post
          Code:
          #!/bin/bash
          systemctl enable --now ratbagd
          You only need to enable a systemd service once, so doing this step every login is not doing anything at all.


          sudo systemctl enable ratbagd.service​ to enable it to be started during boot by systemd. Already done

          sudo systemctl start ratbagd.service​ to manually start it right now.

          systemctl status ratbagd.service to check if it is running, and other info.

          But a normal package should be doing this setup for you. If you manually compiled it, then you definitely would need to manually enable it.

          If you are having problems with piper, what is happening?

          Run the last command above and see what it shows.

          Where are you sourcing libratbag, if you are not using native packaging?
          Which Kubuntu release are you running?

          I have used libratbag and piper in the recent past and have never needed to manually start ratbagd.
          Last edited by claydoh; Today, 06:14 AM.
          Self-built: Asus PRIME B550M-K/Ryzen 5600GT/32Gb/Intel ARC B580 12Gb/KDE neon
          HP Elitedesk 800 G3 Mini: i5-7500T(35w)/32Gb/Kubuntu LTS
          HP Chromebook 14: i5-1135G7/8Gb/512Gb SSD/KDE Linux

          Comment


            #5
            Originally posted by claydoh View Post
            You only need to enable a systemd service once, so doing this step every login is not doing anything at all.
            Yeah that's what the internets told me too. But if I don't run the script the piper stuff doesn't happen.

            I use some extra buttons on the mouse to change the DPI to allow me to turn fine control on and off.

            nick@Nix-L1:~$ systemctl status ratbagd.service
            ○ ratbagd.service - Daemon to introspect and modify configurable mice
            Loaded: loaded (/usr/lib/systemd/system/ratbagd.service; enabled; preset: enabled)
            Active: inactive (dead)


            FYI nothing compiled by me. All just stable branch

            Distributor ID: Ubuntu
            Description: Ubuntu 26.04 LTS
            Release: 26.04
            Codename: resolute



            My piper config has multiple resolutions.
            I have assigned buttons to resolution up and resolution down and applied
            Resolutions states as active
            Doesn't make a difference

            I believe I had to add some lines to a file. I'll track down the info

            Last edited by knuuser; Today, 06:41 AM.

            Comment


              #6
              Originally posted by claydoh View Post
              If you are having problems with piper, what is happening?
              What was happening was Piper didn't seem to work. Dunno why.

              Purged and reinstalled ratbagd and piper. Works now with no script

              Probably user error first time around

              Comment


                #7
                Enabling a systemd service does not tell systemd to actually start it , so something else is at play. I don't know how this is making things work for you, though.

                The 'enable' option with systemctl is basically symlinkung a text file into an appropriate directory. Any command in that file isn't run until it is called for, during boot.

                Piper is a separate entity here, so any configs related to this application likely aren't at fault, but it won't hurt to check.

                At first glance it appears they ratbagd died or crashed or failed to start normally.

                I'll take a peek but it won't be for a while, as it is late here.

                Ratbagd also is using dbus so it may not stay running if there isn't something calling it.

                But at least you have it working now.
                Self-built: Asus PRIME B550M-K/Ryzen 5600GT/32Gb/Intel ARC B580 12Gb/KDE neon
                HP Elitedesk 800 G3 Mini: i5-7500T(35w)/32Gb/Kubuntu LTS
                HP Chromebook 14: i5-1135G7/8Gb/512Gb SSD/KDE Linux

                Comment

                Users Viewing This Topic

                Collapse

                There are 0 users viewing this topic.

                Working...
                X