Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Permission



  Access control in Java -- Permission check order

Previously we showed you how to turn on SecurityManager in Java. After SecurityManager is turned on, a series of permission checks will be applied on the code you are calling in your application to protect some resources against malicious access such as files, sockets etc. To perform these permission checks, a set of Permissions will be created and checked using the AccessController. The AccessController has three purposes : To decide whether an access to a critical system resource is to be all...

   JAVA,SECURITY,ACCESSCONTROLLER     2016-03-07 04:17:40

  Set file permission in Java

Prior to Java 6,  there is no good solution at the Java level to provide file permission management. You need to implement your own native methods or call the Runtime.exec() to invoke the system routine such as chmod in LInux. Since Java 6, Java introduces a set of methods which can be used to set the file permission at Java level. These methods include: File.setReadable(boolean); File.setWritable(boolean); FIle.setExecutable(boolean); File.setReadable(boolean, boolean); File.setWritable(bo...

   JAVA, FILE PERMISSION, POSIX,learnjava     2015-08-29 03:37:37

  Access control in Java -- doPrivileged

Previously we have introduced how Java performs permission check to protect resource access. What if sometimes we need to give some class the temporary access to some resource which it initially doesn't have? AccessController provides six doPrivileged methods to fulfill this requirement. These six methods have below signatures : static T doPrivileged(PrivilegedAction action)static T doPrivileged(PrivilegedAction action, AccessControlContext context)static T doPrivileged(PrivilegedExceptionA...

   JAVA,SECURITY,DOPRIVILEGED     2016-03-08 05:46:42

  When to use STDERR instead of STDOUT

Every process is initialized with three open file descriptors, stdin, stdout, and stderr. stdin is an abstraction for accepting input (from the keyboard or from pipes) and stdout is an abstraction for giving output (to a file, to a pipe, to a console). That's a very simplified explanation but true nonetheless. Those three file descriptors are collectively called 'The Standard Streams'. Where does stderr come from? It's fairly straightforward to understand why stdin and stdout exist, however ...

   UNIX,STDERR,STDOUT,Difference     2012-01-14 12:07:43

  Turn on SecurityManager in Java

SecurityManager in Java is to check whether the application codes can access some restricted resource such as file, socket etc. This can be used in applications which have high security requirements. With this feature turned on, our system resources can be secured with only permitted operations. When JVM starts, it will first check whether the SecurityManager is on by checking the system property java.security.manager, if it's on, then an instance of SecurityManager will be created and it can be...

   SecurityManager,enable,program     2013-12-16 05:03:53

  Some cases where MySQL cannot be started

After installing MySQL, when we try to start MySQL, sometimes we may not be able to start it. The reasons can be different. We share some general cases where MySQL cannot be started. Case 1: Directory or file permission issue If the permission is set wrongly in MySQL's $datadir and its sub directories or files, MySQL will not be able to read and write files normally. Error message: mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data /usr/local/mysql/bin/mysqld_safe: lin...

   MySQL,Error,Log     2013-08-15 03:32:36

  Resolve git issue git@github.com: Permission denied (publickey)

Sometimes when clone a remote repository from github.com, you may see below error. D:\Project\Playground\GitBisect>git clone git@github.com:bradleyboy/bisectercise.git Cloning into 'bisectercise'... git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. The issue occurs when there is no key on your machine which is associated with your github account. To fix the issue, please ...

   GIT,GITHUB,PERMISSION DENIED,PUBLIC KEY     2019-07-12 10:10:49

  Introduction to OAuth (in Plain English)

Last week we talked about giving away your passwords and how you should never do it.  When a website wants to use the services of another—such as Bitly posting to your Twitter stream—instead of asking you to share your password, they should use OAuth instead. OAuth is an authentication protocol that allows you to approve one application interacting with another on your behalf without giving away your password. This is a quick guide to illustrate, as simply as possibl...

   Security,OAuth,Permission,Partial access     2012-04-05 11:39:54

  Using htpasswd to protect your website in Nginx

We need to build a password protected website frequently such as an internal website within the team, demo website. Here what we are talking about is password protection in Nginx server level instead of application level registration and login. We are going to use Nginx server configuration and htpasswd file to achieve password authentication. The final result looks like below(Different browsers may have different interfaces): If the authentication fails, it will report a HTTP error: 401 Author...

   Nginx,Password protected,htpasswd     2013-06-07 21:35:27

  Android socket programming example

Socket is a kind of interface for different sides t communicate, it usually identified by an IP and a port. There are many server side software on a server and they would provide different service. Each server many create some sockets and bind them to some ports so that clients can listen to. Software on the Internet will exchange data though a bidirectional connection established. Each end of the connection has a socket created. In Java, Socket and ServerSocket are in java.net package, ServerSo...

   Android,Socket,Java     2013-05-11 22:17:16