Sponsored Content
Top Forums Programming JAVA code to create file in Linux with specific permission Post 303030674 by bakunin on Wednesday 13th of February 2019 05:01:52 PM
Old 02-13-2019
Quote:
Originally Posted by AbuAliiiiiiiiii
I'm looking for JAVA code to create file in Linux with specific permission
There is a generic system call for that, fopen(). Have a look at its man page and report back if anything in there is unclear.

Quote:
Originally Posted by AbuAliiiiiiiiii
File should be created and saved in Linux in this path \opt\sys\doc by Java with this permission 764
First off, i'd like to question the rationale behind 764. That would mean to give execute rights to the owner and i would be quite surprised if you would want to create an executable.

Second, the path: "\opt\sys\doc" is not a path but rather a filename. Since you do not need to escape regular characters you could also write "optsysdoc" to the same effect. So, what is the path?

I hope this helps.

bakunin
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to create file in ksh scripting with permission(rw-rw-rw)

Hi, Please provide your inputs.. Thanks in Advance, Mansa (1 Reply)
Discussion started by: mansa
1 Replies

2. UNIX for Dummies Questions & Answers

granting permission to file/directory to a specific user

hello, I would like to grant full access to a directory which is owned by root and the web application that created it. I have though of adding the permission to the whole world, but for security reason I would like to grant it to one more user. I have tried this 'chmod -U newUser+wrx... (2 Replies)
Discussion started by: run123
2 Replies

3. Shell Programming and Scripting

How to create a file with full permission in unix script

In my script, I am creating a file ----> then writting one line (i.e. Timestamp) ----> then FTP'ing. The same script can be executed by many other users. While other users executing this script, they couldn't Over write this one line (i.e. Timestamp) My expectation So I wanted to create a... (2 Replies)
Discussion started by: sbmk_design
2 Replies

4. UNIX for Dummies Questions & Answers

Create File with specific Length

We have utility running on Unix which generates Files with records greater than 32760 , (max supported by Mainframe) .Our requirement is to transfer is file to Mainframe .When we ftp the in binary format it automatically wraps it up..so we are good there... But now we need to zip and send the file... (2 Replies)
Discussion started by: nishantrk
2 Replies

5. UNIX for Dummies Questions & Answers

How to create a file with 777 permission.?

Hi Guys, I want to know is there any method to create a file having 777 permission. I am aware of umask, since it is only giving max. 666 permission for files this is not fulfilling my needs. Thanks in advance ---------- Post updated at 12:49 AM ---------- Previous update was at 12:31... (10 Replies)
Discussion started by: sanoop
10 Replies

6. Programming

command linux in java code

Hello Please why the files have not created? Thank you (0 Replies)
Discussion started by: chercheur857
0 Replies

7. Linux

Linux through Java code

Hi How can I write a Java program to execute Linux commands? What is the best approach: Invoking the Linux shell within Java and executing commands or, using the Java APIs to do the stuff. Since it is platform independent, it'll know itself what to do. We need not check which OS the Java... (1 Reply)
Discussion started by: Dorothy
1 Replies

8. Shell Programming and Scripting

Create a new file from another file with lines begins with a specific string

Hi, I have a file with below format myfile.txt aa aa1 aa2 qq aa4 ghs aa6 bbc gdf I m looking to create a file where lines begins with aa. myfile1.txt aa aa1 aa2 (4 Replies)
Discussion started by: Litu1988
4 Replies

9. Shell Programming and Scripting

Need a script to create file permission change restriction

Hello, I am looking for a UNIX shell script which can help me for access restriction. 1) /home/ram, there are number file with .txt extension, which should be only owned "ram" user. like as below ls -lrt *.txt -rwx------ 1 ram dba 11 Jan 4 2015 PASS1.txt -rwx------ 1 ram dba 10 Jan 4... (8 Replies)
Discussion started by: mr.trilok
8 Replies
ACL_DELETE_PERM(3)					   BSD Library Functions Manual 					ACL_DELETE_PERM(3)

NAME
acl_delete_perm -- delete a permission from an ACL permission set LIBRARY
Linux Access Control Lists library (libacl, -lacl). SYNOPSIS
#include <sys/types.h> #include <sys/acl.h> int acl_delete_perm(acl_permset_t permset_d, acl_perm_t perm); DESCRIPTION
The acl_delete_perm() function deletes the permission contained in the argument perm from the permission set referred to by the argument permset_d. An attempt to delete a permission that is not contained in the permission set is not considered an error. Any existing descriptors that refer to permset_d continue to refer to that permission set. RETURN VALUE
The acl_delete_perm() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
If any of the following conditions occur, the acl_delete_perm() function returns -1 and sets errno to the corresponding value: [EINVAL] The argument permset_d is not a valid descriptor for a permission set within an ACL entry. The argument perm does not contain a valid acl_perm_t value. STANDARDS
IEEE Std 1003.1e draft 17 ("POSIX.1e", abandoned) SEE ALSO
acl_add_perm(3), acl_clear_perms(3), acl_get_perm(3), acl_get_permset(3), acl_set_permset(3), acl(5) AUTHOR
Derived from the FreeBSD manual pages written by Robert N M Watson <rwatson@FreeBSD.org>, and adapted for Linux by Andreas Gruenbacher <a.gruenbacher@bestbits.at>. Linux ACL March 23, 2002 Linux ACL
All times are GMT -4. The time now is 07:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy