Permission denied when trying to run app engine project locally - java

The OS MacOS X. Using the terminal, I tried following the steps of how to run a GAE application in a local data store. I dragged the file dev_appserver.sh, located in bin folder afterwards, dragged the war folder of my GAE project.
I get this error "Permission Denied" when I run it from the terminal.
/Eclipse-EE/plugins/com.google.appengine.eclipse.sdkbundle_1.9.15/appengine-java-sdk-1.9.15/bin/dev_appserver.sh
-deploy /Users/myUserName/Documents/workspace/project-name/GAE/war
What could be the problem

Change the Permission u+x to the appcfg.sh file
Note: If you are using Mac OS X or Linux, you must give the command files executable permission before you can run them. For example, to give appcfg.sh executable permission, enter the following command from the appengine-java-sdk/bin/ directory: chmod u+x appcfg.sh
Reference link - https://cloud.google.com/appengine/docs/java/tools/eclipse

Related

Sudo java -jar vs java -jar

I have a server running on Java using the library Pi4j to control the RaspberryPi's GPIOs and a file on which I write the current GPIOs' statuses. When I run the code from IntelliJ IDE everything works just fine.
But when I create the .jar file and run it like
sudo java -jar server.jar
It works fine updating the file, but the GPIOs do not change their status.
When I do
java -jar server.jar
The GPIOs correctly change their status but I get the error java.io.FileNotFoundException: relStat.txt (Permission denied)
My file permission are all set to anyone, so anyone should be able to read, modify and run it.
Why does this happen?
This is a permission issue,
The file owner is the "pi" user.
Which user you are running under?

error=13, permission denied while running a .sh file through automation in eclipse

I am Creating a .sh file newly every time while running automation and while executing that file i am getting permission error always, for time being i am adding permission by running the below command in terminal
chmod u+x "filelocation"
Can someone help me to handle this issue permanently.
As you are always creating the new file, permissions must also be reassigned.
You can run chmod u+x "filelocation" from your code where you created the file to give permissions to the file.
You can reference https://www.mkyong.com/java/how-to-execute-shell-command-from-java/ on how to run shell commands from java using ProcessBuilder.

IntelliJ "Run tests with coverage" is always at 0% and shows an AccessDeniedException

I'm running the elasticsearch gradle project in my IDE.
I'm able to execute tests & debug.
But I'm failing to see any coverage reports.
"AccessControlException: access denied ("java.io.FilePermission" "~/Library/Caches/IntelliJIdea2018.1/coverage/coverage-error.log" "write")
I've attached a screenshot of my IDE.
What you are mission is that when you run chmod 777 on directory, it only changes the permission of that directory only. You also need to change the permissions of the files and directories which are inside of that directory.
For this run the following command to change the permissions recursively for all files and directories:
chmod -R <permissionsettings> <dirname>
Or just change the permission of that particular file to avoid setting permission 777 to all the files.
See this for more information about permissions in linux:

Eclipse | Permission denied when trying to open sh file under Ubuntu

I develop plug-in that works under Ubuntu. The plug-in is required to install a third party software with which it works.
Installation directory is "user home" [System.getProperty("user.home")]
After installation, when I try to open the executable file from this third party software is throwing an exception -
java.io.IOException: Cannot run program >/home/mbaev/Tools/flasher/1.5.0/lua5.1.sh": error=13, Permission denied"
Where should be installed a third party software? Why this directory have permissions by default?
There are probably two reasons:
lua5.1.sh is not executable. You can make it executable by setting:
sudo chmod +x /home/mbaev/Tools/flasher/1.5.0/lua5.1.sh
And then run it:
./home/mbaev/Tools/flasher/1.5.0/lua5.1.sh
If lua5.1.sh is executable but still says error=13, Permission denied. Maybe in this shell some of operations need root permission. Try to run it by sudo:
sudo ./home/mbaev/Tools/flasher/1.5.0/lua5.1.sh
This might also belong to Ask Ubuntu.
Anyway, in order to run a script on linux, you need to have access rights to the directory the script is in, and execute rights set on the script. Most likely you are missing the exec rights.
The command
chmod u+x <myscript.sh>
Will add execute rights for the current user. Try that first.

Android: Permission denied for /data/local/tmp/*

I am trying to run a shell script through an android app. The script has a command which just runs a jar on the device. When I run this command directly on the shell using adb, everything works fine. But when I run it through the script using the android app, I get a permission denied exception (open failed: EACCES (Permission denied)) for the files created in /data/local/tmp folder. Can anyone guide in how to resolve this issue?
This is what my manifest looks like
<manifest ….>
<uses-sdk …>
<uses-permission… .>
…
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
…
<application …>
…
</application>
</manifest>
Thanks.
Update 8 years later
On modern versions of Android, there is no way to run downloaded or generated code (a.k.a. W^X violation). We can only embed prebuilt binaries in the APK (or bundle) (using jniLibs and other settings in gradle.build) and make sure it is extracted to the native file system (explicitly set android:extractNativeLibs = "true"). Then you can run the binary from getContext().getApplicationInfo().nativeLibraryDir.
If I understand the scenario correctly, you create the script on the fly, and use /data/local/tmp as an easy location that is both publicly writable and executable. Once, this was possible. But on recent versions of Android, security has been tightened.
Your app can execute files under /data/data/${your.package}. You can use getContext().getFilesDir() to reliably obtain the full path. Note that you still need to use chmod 500 to ensure that the file has executable permission.
If you have some fixed executables (binaries or scripts) that must be installed with your app, there is a clever trick to let the system package installer take care of all that for you: make sure the file has a name "libsomething.so" and put it in /libs/armeabi directory under the Eclipse project root. After installation, the files will be present in getContext().getApplicationInfo().nativeLibraryDir directory with executable permissions set.
PS You don't need the WRITE_EXTERNAL_STORAGE permission for this to work (maybe you need it for other things your app does).
PPS You can run a shell script from anywhere, including /sdcard, and you don't need executable permission for the script. Instead, use sh -c source full.path.to.script.
You can use the adb interface to copy and/or push files to the /data/local/tmp folder but if you want to use/see them in the terminal app you will need to (in adb interface) first
cd /data/local/tmp
then make a folder inside the folder. Example
mkdir folder
next change the permissions
chmod - R 777 folder
Now you have a folder you can read and write to.
A few things that I would like to know is how to make the system think that the su binary is in the /system/bin folder (without copying) because I can only get tmp... root access because even with root access, I can not remount the system directory as rw because the zte-paragon has its system partition formatted as a read-only file-system
I think the reason is that your Andorid is not been rooted.
the "/data" have the root Permission.
So root your phone first, and give your app the permission.
you can try command:"su" int the shell change to root.
Make sure the /data/local/tmp location is world-executable on your device:
adb shell ls -ld /data/ /data/local/ /data/local/tmp/
drwxrwx--x system system XXXX-XX-XX XX:XX
drwxr-x--x root root XXXX-XX-XX XX:XX
drwxrwx--x shell shell XXXX-XX-XX XX:XX
# ^ all x here == OK!
If it's not, there's nothing you can do, and you need to use the standard storage (internal /data/data/{package} or external /sdcard/).
Make sure you made the file world-readable.
adb shell chmod o+r /data/local/tmp/myfile.txt
You don't need any permissions.

Categories

Resources