I want to add a text to a file that can be access only from a certain account id "appid" and passwd "passx" I tried following code, which does not work.
import os, subprocess
text=str('23.33%')
cmd = ['su', 'appid', '-c echo text >> /tofhisfile.txt']
proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
proc.communicate('passx')
also this does not work
os.system('su appid -c echo text >> /tothisfile.txt')