Re: disable sudo but allow it's alias to work

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Michael via PLUG-discuss
Date:  
To: PLUG
CC: Michael
Subject: Re: disable sudo but allow it's alias to work
here is my history so you can see what chatgpt directed me to do:
bmike1@bmike1-desktop:~$ history
    1  xkill
    2  ls /home
    3  ls /home/bmike1/b
    4  ls /home/bmike1/
    5  nano ~/set_time_after_internet.sh
    6  chmod +x ~/set_time_after_internet.sh
    7  crontab -e
    8  alias aliasforsudo to sudo
    9  nano ~/.bashrc
   10  source ~/.bashrc
   11  aliasforsudo ls /root
   12  nano ~/.bashrc
   13  source ~/.bashrc
   14  aliasforsudo ls /root
   15  source ~/.bashrc
   16  aliasforsudo ls /root
   17  sudo visudo
   18  nano ~/set_time_after_internet.sh
   19  chmod +x ~/set_time_after_internet.sh
   20  crontab -e
   21  aliasforsudo ls /root
   22  SUDO
   23  sudo
   24  sudo cp /usr/bin/sudo /usr/bin/sudo.bak
   25  sudo tee /usr/bin/sudo <<EOF
   26  #!/bin/bash
   27  echo "The sudo command has been disabled."
   28  EOF
   29  sudo mv /usr/bin/sudo /usr/bin/sudo.bak
   30  echo -e '#!/bin/bash\necho "The sudo command has been disabled."' |
sudo tee /usr/bin/sudo
   31  aliasforsudo ls
   32  sudo ls
   33  # Create the dummy sudo script
   34  echo -e '#!/bin/bash\necho "The sudo command has been disabled."' |
sudo tee /usr/bin/sudo
   35  which sudo
   36  sudo
   37  su
   38  aliasforsudo
   39  aliasforsudo
   40  aliasforsudo
   41  sudo
   42  isud
   43  visudo
   44  aliasforsudo visudo
   45  aliasforsudo
   46  aliasforsudo ls
   47  sudo ls
   48  aliasforsudo ls
   49  sudo ls
   50  echo -e '#!/bin/bash\necho "The sudo command has been disabled."' |
sudo tee /usr/bin/sudo
   51  aliasforsudo mv /usr/bin/sudo /usr/bin/sudo.old
   52  echo -e '#!/bin/bash\necho "The sudo command has been disabled."' |
aliasforsudo tee /usr/bin/sudo
   53  aliasforsudo bash -c 'cat > /usr/bin/sudo <<EOF
   54  #!/bin/bash
   55  echo "The sudo command has been disabled."
   56  EOF'
   57  echo -e '#!/bin/bash\necho "The sudo command has been disabled."' >
sudo
   58  aliasforsudo mv sudo /usr/bin/sudo
   59  aliasforsudo ls
   60  su
   61  aliasforsudo ls
   62  sudo ls
   63  aliasforsudo passwd root
   64  su
   65  aliasforsudo sudo
   66  aliasforsudo ls
   67  sudo ls
   68  aliasforsudo visudo
   69  history
bmike1@bmike1-desktop:~$
switced user because sudo disabled
root@bmike1-desktop:/home/bmike1# history
    1  mount -oremount,rw /
    2  cp /usr/bin/sudo.bak /usr/bin/sudo
    3  chmod 4755 /usr/bin/sudo
    4  visudo
    5  mount -o remount,rw /
    6  cp /usr/bin/sudo.bak /usr/bin/sudo
    7  chmod 4755 /usr/bin/sudo
    8  su cmike1
    9  su bmike1
   10  sudo rm /usr/local/bin/sudo
   11  sudo rm /usr/local/bin/sudo_custom
   12  rm /usr/local/bin/sudo_custom
   13  nano ~/.bashrc
   14  which sudo
   15  rm /usr/local/bin/sudo
   16  which sudo
   17  sudo ls
   18  rm /usr/local/bin/sudo
   19  which sudo
   20  ls -l /usr/bin/sudo
   21  nano ~/.bashrc
   22  rm /usr/local/bin/sudo
   23  which sudo
   24  apt update
   25  apt install --reinstall sudo
   26  sudo ls
   27  apt update
   28  apt install --reinstall sudo
   29  which sudo
   30  sudo ls
   31  rm /usr/local/bin/sudo 2>/dev/null
   32  ls -l /usr/bin/sudo
   33  sudo ls
   34  visudo
   35  echo $PATH
   36  unalias sudo 2>/dev/null
   37  sudo
   38  chmod 4755 /usr/bin/sudo
   39  sudo
   40  echo "alias god='sudo'" >> ~/.bashrc
   41  source ~/.bashrc
   42  aliasforsudo ls
   43  tail -f /var/log/syslog
   44  apt --fix-broken install
   45  fg
   46  history
root@bmike1-desktop:/home/bmike1# su bmike1



On Tue, Jul 9, 2024 at 7:46 AM Michael <> wrote:

> chatgpt is being stupid. A couple of days ago it showed me how to create
> an alias for sudo and then disable sudo while letting the alias work. Well,
> I had a power fluctuation and that caused my box to to start booting into
> busybox. So I reinstalled my system and now chatgpt doesn't know how to
> disable sudo while allowing it's alias to work. So I turn to you.
>
> --
> :-)~MIKE~(-:
>



--
:-)~MIKE~(-:
---------------------------------------------------
PLUG-discuss mailing list:
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss