0

I'm new to ubuntu and logged in as user abc (shows Desktop)

I need to call the following app when I'm logged in as user abc: /home/xyz/zzzapp/zzz -param1 -param2

user abc and xyz are members of sudo.

I'd like to have a .desktop shortcut on abc that logs in as user xyz opens a terminal and calls the app zzz -param1 -param2

If terminal asks me for password it's ok for me

how can I do this?

Bruni
  • 11,099
ssssstut
  • 939

1 Answers1

1

The ~/.local/share/applications/zzz.desktop file will look like:

[Desktop Entry]
Name=Run zzz as xyz
Exec=bash -c 'su -c "/home/xyz/zzzapp/zzz -param1 -param2" xyz; read -p "Hit Enter to close terminal:"'
Terminal=true
Type=Application

Why do you need a desktop icon? I would recommend this:

  1. add this function to your ~/.bashrc

    zzz() { su -c '~/zzzapp/zzz -param1 "$(bash get_ggggg.sh)"' -l xyz; }
    
  2. when you want to run it, open a gnome-terminal and enter the command zzz

glenn jackman
  • 18,218