WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: ondemand logic  (Read 6483 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11629
Re: ondemand logic
« Reply #15 on: August 18, 2021, 11:29:57 PM »
Hi nick65go
Code: [Select]
sudo -u tc -exec ($@).
Now you are the one assuming that  $USER = tc.  If you are going to  sudo -u  then at least do it like this:
Code: [Select]
sudo -u `CAT /etc/sysconfig/tcuser`
Sorry for the uppercase  cat , forum error.

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: ondemand logic
« Reply #16 on: August 19, 2021, 05:51:27 AM »
Hi nick65go
Code: [Select]
sudo -u tc -exec ($@).
Now you are the one assuming that  $USER = tc.  If you are going to  sudo -u  then at least do it like this:
Code: [Select]
sudo -u `CAT /etc/sysconfig/tcuser`
Sorry for the uppercase  cat , forum error.

I have update the function, sudo as shown does not work

In attachment because forum error. Thank you.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11629
Re: ondemand logic
« Reply #17 on: August 19, 2021, 09:29:50 AM »
Hi Roberto A. Foglietta
The attachment you posted shows  sudo -  instead of  sudo -u

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: ondemand logic
« Reply #18 on: August 19, 2021, 09:48:02 AM »
Hi Roberto A. Foglietta
The attachment you posted shows  sudo -  instead of  sudo -u

I am not using sudo:

Code: [Select]
su - $user -c "$0 $*"
please check. Thank you, R.

P.S: this line of code, it does not work:

Code: [Select]
sudo -u tc -exec ($@)
but it is not mine.
« Last Edit: August 19, 2021, 09:50:00 AM by Roberto A. Foglietta »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11629
Re: ondemand logic
« Reply #19 on: August 19, 2021, 10:34:48 AM »
Hi Roberto A. Foglietta
... I am not using sudo: ...
Sorry, my mistake.

How about this:
Code: [Select]
tc@E310:~/su$ su `cat /etc/sysconfig/tcuser` -c "touch 1"
tc@E310:~/su$ ls -l
total 0
-rw-r--r-- 1 tc staff 0 Aug 19 10:28 1
tc@E310:~/su$