Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can JAVA set unix file permissions? i.e. setuid chmod chown...

278 views
Skip to first unread message

G

unread,
Mar 23, 2000, 3:00:00 AM3/23/00
to
Greetings all,

I want to start using java and the current project I'm working on deals
with creating unix directories and files and setting the uid and gid
ownership of those files (creating qmail accounts). I can't seem to find
where java provides that kind of functionality. Am I missing something?

Granted Java was not intended as a unix system admins programming
language, but a language without file manipulation functions.... Please
tell me I'm wrong.

Thanks,
Gene Titus
Sr. Operating System Specialist
The Office of Telecommunication Services
The University of Texas at Austin

Jon A. Cruz

unread,
Mar 23, 2000, 3:00:00 AM3/23/00
to
G wrote:

> Greetings all,
>
> I want to start using java and the current project I'm working on deals
> with creating unix directories and files and setting the uid and gid
> ownership of those files (creating qmail accounts). I can't seem to find
> where java provides that kind of functionality. Am I missing something?
>
> Granted Java was not intended as a unix system admins programming
> language, but a language without file manipulation functions.... Please
> tell me I'm wrong.

No. You're not wrong.

How would setting a gid on a file over here on my FAT filesystem work? Or
uid for that matter?

--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.


George

unread,
Mar 23, 2000, 3:00:00 AM3/23/00
to
G wrote:

> Greetings all,
>
> I want to start using java and the current project I'm working on deals
> with creating unix directories and files and setting the uid and gid
> ownership of those files (creating qmail accounts). I can't seem to find
> where java provides that kind of functionality. Am I missing something?
>
> Granted Java was not intended as a unix system admins programming
> language, but a language without file manipulation functions.... Please
> tell me I'm wrong.
>

> Thanks,
> Gene Titus
> Sr. Operating System Specialist
> The Office of Telecommunication Services
> The University of Texas at Austin

You can use System.exec() to set the access permissions you want.


Stuart D. Gathman

unread,
Mar 24, 2000, 3:00:00 AM3/24/00
to

G wrote:

> I want to start using java and the current project I'm working on deals
> with creating unix directories and files and setting the uid and gid
> ownership of those files (creating qmail accounts). I can't seem to find
> where java provides that kind of functionality. Am I missing something?
>
> Granted Java was not intended as a unix system admins programming
> language, but a language without file manipulation functions.... Please
> tell me I'm wrong.

The standard library is designed to be cross platform. Since Mac, DOS,
Windoze, to name a few platforms with JVMs available, have no user id or group
id, these features would be problematic.

You can develop platform specific libraries using the JNI standard. I have
been incrementally working on a Posix library. Cooincidentally, my very next
project for the posix library is an extension to java.io.File which support
common posix operations. The JNI code is actually quite straightforward for
such things. If you will collaborate on what the Java interface should look
like, I'll code up the JNI. Here is the posix library so far:

http://www.bmsi.com/java/posix/posix.html

Familiarize yourself with java.io.File - which provides the cross platform
file manipulation. Then we can discuss what Posix extension we want.

--
Stuart D. Gathman <stu...@bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Microsoft is the QWERTY of Operating Systems" - SDG
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
(HINT: Find a translation of the "Dies Irae".)

0 new messages