{"id":15751446,"url":"https://github.com/remram44/read-sudo-timestamp","last_synced_at":"2026-04-27T22:33:01.554Z","repository":{"id":66117873,"uuid":"597946331","full_name":"remram44/read-sudo-timestamp","owner":"remram44","description":"Read sudo's files to check for a valid timestamp, for use in shell prompts","archived":false,"fork":false,"pushed_at":"2023-02-07T02:22:02.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"trunk","last_synced_at":"2026-01-14T02:02:58.176Z","etag":null,"topics":["linux","linux-shell","shell-prompt","sudo","unix"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remram44.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-06T03:44:08.000Z","updated_at":"2024-04-17T00:01:35.000Z","dependencies_parsed_at":"2023-02-20T18:00:59.976Z","dependency_job_id":null,"html_url":"https://github.com/remram44/read-sudo-timestamp","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"75bdafb6cea01bde1d7a9670f48f3dd8175918d2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/remram44/read-sudo-timestamp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remram44%2Fread-sudo-timestamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remram44%2Fread-sudo-timestamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remram44%2Fread-sudo-timestamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remram44%2Fread-sudo-timestamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remram44","download_url":"https://codeload.github.com/remram44/read-sudo-timestamp/tar.gz/refs/heads/trunk","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remram44%2Fread-sudo-timestamp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32358509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","linux-shell","shell-prompt","sudo","unix"],"created_at":"2024-10-04T07:01:45.485Z","updated_at":"2026-04-27T22:33:01.538Z","avatar_url":"https://github.com/remram44.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a simple utility that reads sudo's timestamp file to figure out whether you have a valid timestamp.\n\nThis allows you to show a warning in your prompt if your shell currently allows you to run commands with sudo without a password.\n\n# How to use\n\nBuild this executable with `make`, then install it with `sudo make install`. This will make it set-uid root so it can read sudo's timestamp files.\n\nYou can then put something like this in your shell's config file (example for bashrc):\n\n```bash\nPS1='`if read_sudo_timestamp 900 \u003e/dev/null; then echo \"SUDO \"; fi`\\u@\\h:\\w\\$ '\n```\n\n`900` in the code above is sudo's timeout in seconds. I didn't try to get it from sudo's configuration file, it is easy enough for you to supply.\n\n# Is a separate program really required?\n\nUnfortunately sudo never provided a way to do this. On some versions you can abuse `sudo -v` to check whether there is a valid timestamp, however this counts as a failed login on some versions, sending the admin an email every time (thousands of emails if you have this in your prompt...), [sudo#131](https://github.com/sudo-project/sudo/issues/131). Additionally this would refresh the timestamp every time instead of only checking it.\n\nThe sudo project has been asked for a solution but refused, see [sudo#130](https://github.com/sudo-project/sudo/issues/130), so writing a separate program seemed the easiest way.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremram44%2Fread-sudo-timestamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremram44%2Fread-sudo-timestamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremram44%2Fread-sudo-timestamp/lists"}