Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 635077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:21:54+00:00 2026-05-13T20:21:54+00:00

I want my application (PHP, but that shouldn’t matter) to store some data in

  • 0

I want my application (PHP, but that shouldn’t matter) to store some data in a shared repository (the APC user cache, but again irrelevant). To prevent users from reading eachother’s data I’d like to encrypt it per user.

I could have the user specify the key in his configuration file for the application, but I’d rather generate it automatically so the user doesn’t have to bother.

For this I would need a piece of data on the system that (almost) never changes and is only readable by the current user. I can then hash that, or something, to generate the key. Does something like that exist in a default user account on a Linux system?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:21:55+00:00Added an answer on May 13, 2026 at 8:21 pm

    Storing a key in ~/.yourApp will work, provided that you set the permissions of the key file to 0600 and the permissions of the ~/.yourApp directory to 0700.

    Of course you are relying on people not being able / willing to use root access to access other users’ key files. If that is a concern you are going to need to use some kind of keystore where access is controlled by a master passphrase.

    EDIT : in answer to the OP’s followup questions below:

    Even then the master passphrase must be stored on the system, or users will have to enter it manually for every request (I assume even storing it in memory is unsafe if you don’t trust root).

    It is all relative. If you are really paranoid, you don’t store the key on any machine that you don’t totally control. On the other hand, most people are prepared to trust that root has not been compromised and (as a fallback) that it requires some effort for someone with root access to break a keystore. An unlocked copy of your keystore in memory may count as “safe enough”. Certainly, a lot of user keystore software seems to work on that assumption.

    Why should the directory be set to 0700? Even if it was 0777, a file inside it with 0600 would still be unreadable to others, right?

    Partly general paranoia, partly belt-and-braces, partly a sign to other users to “keep your nose out of my private stuff”, and partly to protect against someone by replacing your key file. The last point could be critical … or not … depending on exactly how the key is used by your application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an application in PHP 5. I want to delete some rows in
I want my web application users to download some data as an Excel file.
I want to run a web application on php and mysql, using the CakePHP
I just want to send SMS from my web application in PHP. Can anyone
I am writing a web application using PHP. I want to use the MVC
I want in an application with a simple text input, enriched with some marks
in my application i want to support both mass memory and memory card. but
I want my application to clean all the temp files it used, the problem
I want my WPF application to be skinnable, by applying a certain XAML template,
I have a ClickOnce deployed application I want to launch from VBScript, similar to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.