Autoit runas access denied - autoit

I need to copy a file in C:\Windows\System32\drivers\etc folder using a non-admin user.
I done a script using autoit and runas function but I receive "access denied"
How can I copy a file in C:\Windows\System32\drivers\etc using a non-admin user account?

First check that file you copy can be copied with basic batch script. Sometime overwrite is not possible due ownership rights.

Try that rights elevation code:
If Not IsAdmin() Then ;if not admin become admin
ShellExecute(#AutoItExe, $CmdLineRaw, #WorkingDir , "runas", #SW_SHOWNORMAL) ; "runas" - require admin privileges. i don't now how it works. ¯\_(ツ)_/¯ magic...
Else ;normal execution if already admin

Related

How to fix incompatibility between mac os permission of files & folders with our hosting server

Every time I upload my theme folder(WordPress) from my Mac OS to my hosting server(CPanel), I have lots of permission errors and I should fix the permissions again on our server.
Is there any way to fix permission on my Mac OS to be compatible with my server permissions (folders:775 & files:644 )?
A quick google search found this at macinstruct.
How to Modify Permissions with chmod
For total control over permissions, you can use two Unix commands - ls and chmod - to display permissions and modify them. Assume you want to find a folder’s current permissions and then change them to 755. This would give you as the owner read, write and execute permissions, and everyone else read and execute permissions.
Here’s how to find a folder’s current permissions and change them:
Open the Terminal application.
Once you direct yourself to where your files/folders are located...
Type ls –l, and then press Return. The symbolic permissions of the files and folders in your home directory are displayed, as shown below.
Type chmod 755 foldername, and then press Return. This changes the permissions of the folder to rwxr-xr-x.
When it comes to using the ls and chmod commands, practice makes perfect. Try modifying the permissions on a couple of sample files. If you need more help, use the man command to display the manual pages for these commands (e.g., man ls).

Why does a new default directory have user executable permissions where as a new file only has user read and write permissions?

Noticed this when creating a new directory in unix, and was just curious as to why this is so.
Thanks
A new directory created by a user and owned by the user with full permissions is no big deal. However, a new file/program if executed accidentally or before configuration could have catastrophic results. So the designers decided to give you a layer of protection.
It also prevents other users from executing the file unless you specifically grant permission.
Because you need the executable permissions to naviguate into the directory.
So basic permissions allow user to read file (read file permission), and to access file in directory (directory execute permission).
Note that read permission on a folder allow user to list files in it. (But doesnt allow to read them unless execute permission is granted too as I said in the first place)
Basically, +x on a directory means that the user can 'execute it' hence change into it (replace user by group or other depending on position in permissions).
Hence drwxr--r-- means only user can change into directory. More here.
The directory needs to have executable permissions so you can do things such as cd into it. Also the executable permission lets you look into the directory for inode information of the files it contains.
More info can be found at this source.

openshift wordpress plugin needs to be granted write access, how do this?

I am trying to install CiviCRM in my openshift wordpress 'gear' And I am getting the following when I attempt to run civicrm's installation wizard:
The user account used by your web-server - 542ddc2950044666c40008d9 -
needs to be granted write access to the following directory in order
to configure the CiviCRM settings file:
//var/lib/openshift/542ddc2950044666c40008d9/app-root/data/plugins/files
Does anyone know if what it is asking is possible?
and then how do I go about setting that?
Thanks!
The plugins/files/civicrm directory is where CiviCRM stores its cached templates, file attachments, premium (thank-you gift) images, and more. It'll need to save stuff there regularly, not just at first.
The best thing to do is to log in through SSH like developercorey recommends and:
cd ~/app-root/plugins
chmod 755 files (changing the permissions so the owner can write and everyone can read/execute)
chown 542ddc2950044666c40008d9:542ddc2950044666c40008d9 files (making the user that the web server runs as ("542ddc2950044666c40008d9" as mentioned in the error message) be the owner of the directory
have the installer check again
SSH into your gear using the rhc ssh command
cd ~/app-root/plugins
ls -lah
Look for the "files" directory and see what the user and the permissions are on that folder, you can change with the "chmod" command to allow it to be written to by the web server, but be careful what you do or you could cause a major headache for yourself (like getting your WP blog hacked). Hopefully the instructions for that plugin include setting the permissions to something reasonable when you are done.

ASP - Permission denied

before I start, I'm a PHP programmer, not an ASP programmer, but at my job, they use ASP and I don't have acces to the server, but I can contact the person in charge.
I'm working on an ASP function for work and I alway hit this "Permission denied" error. I made some search and I found that the account need permission to run the script. It's maybe just me, but I don't understand that ASP check the user before run a script, I mean, it's a public website, obviously they will not have acces if I don't.
Can I change the file so anyone can run it ?
EDIT :
My script is trying to edit a file on the server
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.OpenTextFile(Server.MapPath("test.txt"),8,true)
f.WriteLine("This text will be added to the end of file")
f.Close
set f=Nothing
set fs=Nothing
Thanks
The account that IIS uses (probably iusr) needs to have read/write permissions on the target folder. I would recommend using a temp folder (anything other than the website's root folder)
By default, the account will have no permissions. That's simply basic security. You need to have whoever administers that machine give permissions on an appropriate location.

wordpress error

i completed my client site in wordpress,then i uploaded this site into client server(FTP) but site is not going to open
this error is occur
"
Warning: fopen(piecemakerXML.xml) [function.fopen]: failed to open stream: Permission denied in F:\inetpub\vhosts\kni.com.my\httpdocs\wp-content\themes\twentyten\header.php on line 133
can't open file"
It's a file system permissions problem. WordPress does not have permission to access that file or the folder it's in. You'll have to change that. Most FTP programs have a CHMOD command built in, or you can shell in to the server, or use the hosting control panel.
Check the permissions of the file to ensure it is at least readable by the owner. And if you also want to write to it, it should be writable
Check out the page on Wordpress about file permissions. It has a pretty good list of example permissions
http://codex.wordpress.org/Changing_File_Permissions
Also Check out wikipedia
And to Change file permissions, do what #Dan said in his answer.

Resources